Interface Meter


  • @ThreadSafe
    public interface Meter
    Meter is a simple, interface that allows users to record measurements (metrics).

    There are two ways to record measurements:

    • Record raw measurements, and defer defining the aggregation and the labels for the exported Instrument. This should be used in libraries like gRPC to record measurements like "server_latency" or "received_bytes".
    • Record pre-defined aggregation data (or already aggregated data). This should be used to report cpu/memory usage, or simple metrics like "queue_length".

    TODO: Update comment.

    • Method Detail

      • doubleCounterBuilder

        DoubleCounterBuilder doubleCounterBuilder​(java.lang.String name)
        Returns a builder for a DoubleCounter.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a DoubleCounter.Builder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longCounterBuilder

        LongCounterBuilder longCounterBuilder​(java.lang.String name)
        Returns a builder for a LongCounter.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a LongCounter.Builder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • doubleUpDownCounterBuilder

        DoubleUpDownCounterBuilder doubleUpDownCounterBuilder​(java.lang.String name)
        Returns a builder for a DoubleUpDownCounter.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a DoubleCounter.Builder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longUpDownCounterBuilder

        LongUpDownCounterBuilder longUpDownCounterBuilder​(java.lang.String name)
        Returns a builder for a LongUpDownCounter.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a LongCounter.Builder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • doubleValueRecorderBuilder

        DoubleValueRecorderBuilder doubleValueRecorderBuilder​(java.lang.String name)
        Returns a new builder for a DoubleValueRecorder.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a DoubleValueRecorder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longValueRecorderBuilder

        LongValueRecorderBuilder longValueRecorderBuilder​(java.lang.String name)
        Returns a new builder for a LongValueRecorder.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a LongValueRecorder.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • doubleSumObserverBuilder

        DoubleSumObserverBuilder doubleSumObserverBuilder​(java.lang.String name)
        Returns a new builder for a DoubleSumObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a DoubleSumObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longSumObserverBuilder

        LongSumObserverBuilder longSumObserverBuilder​(java.lang.String name)
        Returns a new builder for a LongSumObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a LongSumObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • doubleUpDownSumObserverBuilder

        DoubleUpDownSumObserverBuilder doubleUpDownSumObserverBuilder​(java.lang.String name)
        Returns a new builder for a DoubleUpDownSumObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a DoubleUpDownObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longUpDownSumObserverBuilder

        LongUpDownSumObserverBuilder longUpDownSumObserverBuilder​(java.lang.String name)
        Returns a new builder for a LongUpDownSumObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a LongUpDownSumObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • doubleValueObserverBuilder

        DoubleValueObserverBuilder doubleValueObserverBuilder​(java.lang.String name)
        Returns a new builder for a DoubleValueObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a DoubleValueObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • longValueObserverBuilder

        LongValueObserverBuilder longValueObserverBuilder​(java.lang.String name)
        Returns a new builder for a LongValueObserver.
        Parameters:
        name - the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.
        Returns:
        a new builder for a LongValueObserver.
        Throws:
        java.lang.NullPointerException - if name is null.
        java.lang.IllegalArgumentException - if different metric with the same name already registered.
        java.lang.IllegalArgumentException - if the name does not match the requirements.
      • newBatchRecorder

        BatchRecorder newBatchRecorder​(java.lang.String... keyValuePairs)
        Utility method that allows users to atomically record measurements to a set of Instruments with a common set of labels.
        Parameters:
        keyValuePairs - The set of labels to associate with this recorder and all it's recordings.
        Returns:
        a MeasureBatchRecorder that can be use to atomically record a set of measurements associated with different Measures.