Class GroovyMetricEnvironment

java.lang.Object
io.opentelemetry.contrib.jmxmetrics.GroovyMetricEnvironment

public class GroovyMetricEnvironment extends Object
  • Constructor Details

    • GroovyMetricEnvironment

      public GroovyMetricEnvironment(io.opentelemetry.contrib.jmxmetrics.JmxConfig config, String instrumentationName, String instrumentationVersion)
      A central context for creating and exporting metrics, to be used by groovy scripts via OtelHelper.
      Parameters:
      config - - used to establish exporter type (logging by default) and connection info
      instrumentationName - - meter's instrumentationName
      instrumentationVersion - - meter's instrumentationVersion
    • GroovyMetricEnvironment

      public GroovyMetricEnvironment(io.opentelemetry.contrib.jmxmetrics.JmxConfig config)
      Configures with default meter identifiers.
      Parameters:
      config - - used to establish exporter type (logging by default) and connection info
  • Method Details

    • flush

      public void flush()
      Will collect all metrics from OpenTelemetrySdk and export via configured exporter.
    • mapToAttributes

      protected static io.opentelemetry.api.common.Attributes mapToAttributes(@Nullable Map<String,String> labelMap)
    • getDoubleCounter

      public io.opentelemetry.api.metrics.DoubleCounter getDoubleCounter(String name, String description, String unit)
      Build or retrieve previously registered DoubleCounter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized DoubleCounter
    • getLongCounter

      public io.opentelemetry.api.metrics.LongCounter getLongCounter(String name, String description, String unit)
      Build or retrieve previously registered LongCounter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized LongCounter
    • getDoubleUpDownCounter

      public io.opentelemetry.api.metrics.DoubleUpDownCounter getDoubleUpDownCounter(String name, String description, String unit)
      Build or retrieve previously registered DoubleUpDownCounter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized DoubleUpDownCounter
    • getLongUpDownCounter

      public io.opentelemetry.api.metrics.LongUpDownCounter getLongUpDownCounter(String name, String description, String unit)
      Build or retrieve previously registered LongUpDownCounter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized LongUpDownCounter
    • getDoubleHistogram

      public io.opentelemetry.api.metrics.DoubleHistogram getDoubleHistogram(String name, String description, String unit)
      Build or retrieve previously registered DoubleHistogram.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized DoubleHistogram
    • getLongHistogram

      public io.opentelemetry.api.metrics.LongHistogram getLongHistogram(String name, String description, String unit)
      Build or retrieve previously registered .
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      Returns:
      new or memoized LongHistogram
    • registerDoubleValueCallback

      public void registerDoubleValueCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater)
      Register a double observable gauge.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater
    • registerLongValueCallback

      public void registerLongValueCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater)
      Register a long observable gauge.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater
    • registerDoubleCounterCallback

      public void registerDoubleCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater)
      Register an observable double counter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater
    • registerLongCounterCallback

      public void registerLongCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater)
      Register an observable long counter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater
    • registerDoubleUpDownCounterCallback

      public void registerDoubleUpDownCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater)
      Register an observable double updown counter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater
    • registerLongUpDownCounterCallback

      public void registerLongUpDownCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater)
      Register an observable long updown counter.
      Parameters:
      name - - metric name
      description - metric description
      unit - - metric unit
      updater - - the value updater