Class OtelCollectorMetrics

java.lang.Object
codes.grow.packages.otelcollector.OtelCollectorMetrics

public final class OtelCollectorMetrics extends Object
OTLP metrics for the collector: the official OTLP metric exporter (cumulative temporality) and meter / counter / upDownCounter / histogram / gauge helpers on the global MeterProvider (registered by initTelemetry unless setGlobal(false)). A TelemetryHandle offers the same helpers on its own provider.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Meter name used by the helpers when none is given.
    static final String
    Meter name of the JVM runtime metrics.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.opentelemetry.api.metrics.LongCounter
    Monotonic counter without options.
    static io.opentelemetry.api.metrics.LongCounter
    Monotonic counter (OTLP sum, isMonotonic, cumulative) on the global provider.
    static io.opentelemetry.api.metrics.DoubleGauge
    gauge(String name, InstrumentOptions options)
    Synchronous gauge (OTLP gauge, last value) on the global provider.
    static io.opentelemetry.api.metrics.DoubleHistogram
    Histogram with optional explicit bucket boundaries on the global provider.
    static io.opentelemetry.api.metrics.Meter
    A meter named DEFAULT_METER_NAME from the global provider.
    static io.opentelemetry.api.metrics.Meter
    meter(String name)
    A meter from the global provider.
    static io.opentelemetry.sdk.metrics.export.MetricExporter
    The official OTLP metric exporter for a collector config: http/protobuf → OtlpHttpMetricExporter (metricsUrl), grpc → OtlpGrpcMetricExporter.
    static io.opentelemetry.api.metrics.LongUpDownCounter
    Up/down counter (OTLP non-monotonic sum) on the global provider.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_METER_NAME

      public static final String DEFAULT_METER_NAME
      Meter name used by the helpers when none is given.
      See Also:
    • RUNTIME_METER_NAME

      public static final String RUNTIME_METER_NAME
      Meter name of the JVM runtime metrics.
      See Also:
  • Method Details

    • metricExporter

      public static io.opentelemetry.sdk.metrics.export.MetricExporter metricExporter(OtelCollectorConfig config)
      The official OTLP metric exporter for a collector config: http/protobuf → OtlpHttpMetricExporter (metricsUrl), grpc → OtlpGrpcMetricExporter.
      Parameters:
      config - collector config
      Returns:
      the exporter
    • meter

      public static io.opentelemetry.api.metrics.Meter meter()
      A meter named DEFAULT_METER_NAME from the global provider.
      Returns:
      the meter
    • meter

      public static io.opentelemetry.api.metrics.Meter meter(String name)
      A meter from the global provider.
      Parameters:
      name - instrumentation scope name
      Returns:
      the meter
    • counter

      public static io.opentelemetry.api.metrics.LongCounter counter(String name, InstrumentOptions options)
      Monotonic counter (OTLP sum, isMonotonic, cumulative) on the global provider.
      Parameters:
      name - instrument name
      options - description, unit, meter
      Returns:
      the counter
    • counter

      public static io.opentelemetry.api.metrics.LongCounter counter(String name)
      Monotonic counter without options.
      Parameters:
      name - instrument name
      Returns:
      the counter
    • upDownCounter

      public static io.opentelemetry.api.metrics.LongUpDownCounter upDownCounter(String name, InstrumentOptions options)
      Up/down counter (OTLP non-monotonic sum) on the global provider.
      Parameters:
      name - instrument name
      options - description, unit, meter
      Returns:
      the counter
    • histogram

      public static io.opentelemetry.api.metrics.DoubleHistogram histogram(String name, InstrumentOptions options)
      Histogram with optional explicit bucket boundaries on the global provider.
      Parameters:
      name - instrument name
      options - description, unit, meter, boundaries
      Returns:
      the histogram
    • gauge

      public static io.opentelemetry.api.metrics.DoubleGauge gauge(String name, InstrumentOptions options)
      Synchronous gauge (OTLP gauge, last value) on the global provider.
      Parameters:
      name - instrument name
      options - description, unit, meter
      Returns:
      the gauge