Class GroovyMetricEnvironment
java.lang.Object
io.opentelemetry.contrib.jmxmetrics.GroovyMetricEnvironment
-
Constructor Summary
ConstructorsConstructorDescriptionGroovyMetricEnvironment(io.opentelemetry.contrib.jmxmetrics.JmxConfig config) Configures with default meter identifiers.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 viaOtelHelper. -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Will collect all metrics from OpenTelemetrySdk and export via configured exporter.io.opentelemetry.api.metrics.DoubleCountergetDoubleCounter(String name, String description, String unit) Build or retrieve previously registeredDoubleCounter.io.opentelemetry.api.metrics.DoubleHistogramgetDoubleHistogram(String name, String description, String unit) Build or retrieve previously registeredDoubleHistogram.io.opentelemetry.api.metrics.DoubleUpDownCountergetDoubleUpDownCounter(String name, String description, String unit) Build or retrieve previously registeredDoubleUpDownCounter.io.opentelemetry.api.metrics.LongCountergetLongCounter(String name, String description, String unit) Build or retrieve previously registeredLongCounter.io.opentelemetry.api.metrics.LongHistogramgetLongHistogram(String name, String description, String unit) Build or retrieve previously registered .io.opentelemetry.api.metrics.LongUpDownCountergetLongUpDownCounter(String name, String description, String unit) Build or retrieve previously registeredLongUpDownCounter.protected static io.opentelemetry.api.common.AttributesmapToAttributes(Map<String, String> labelMap) voidregisterDoubleCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater) Register an observable double counter.voidregisterDoubleUpDownCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater) Register an observable double updown counter.voidregisterDoubleValueCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableDoubleMeasurement> updater) Register a double observable gauge.voidregisterLongCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater) Register an observable long counter.voidregisterLongUpDownCounterCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater) Register an observable long updown counter.voidregisterLongValueCallback(String name, String description, String unit, Consumer<io.opentelemetry.api.metrics.ObservableLongMeasurement> updater) Register a long observable gauge.
-
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 viaOtelHelper.- Parameters:
config- - used to establish exporter type (logging by default) and connection infoinstrumentationName- - meter's instrumentationNameinstrumentationVersion- - 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
-
getDoubleCounter
public io.opentelemetry.api.metrics.DoubleCounter getDoubleCounter(String name, String description, String unit) Build or retrieve previously registeredDoubleCounter.- Parameters:
name- - metric namedescription- metric descriptionunit- - 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 registeredLongCounter.- Parameters:
name- - metric namedescription- metric descriptionunit- - 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 registeredDoubleUpDownCounter.- Parameters:
name- - metric namedescription- metric descriptionunit- - 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 registeredLongUpDownCounter.- Parameters:
name- - metric namedescription- metric descriptionunit- - 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 registeredDoubleHistogram.- Parameters:
name- - metric namedescription- metric descriptionunit- - 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 namedescription- metric descriptionunit- - 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 namedescription- metric descriptionunit- - metric unitupdater- - 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 namedescription- metric descriptionunit- - metric unitupdater- - 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 namedescription- metric descriptionunit- - metric unitupdater- - 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 namedescription- metric descriptionunit- - metric unitupdater- - 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 namedescription- metric descriptionunit- - metric unitupdater- - 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 namedescription- metric descriptionunit- - metric unitupdater- - the value updater
-