Adopt Otel 0.9.1 (#19)
* Adopt OTel 0.9.1 * Remove constant labels from instrument helpers * Adopt removal of MetricData.Descriptor * Move to Java 8 * Adopt new exporter properties
This commit is contained in:
parent
657693ed1e
commit
3de42160e9
|
|
@ -88,51 +88,47 @@ via `otel.jmx.groovy.script`, it will then run the script on the specified
|
||||||
|
|
||||||
### OpenTelemetry Synchronous Instrument Helpers
|
### OpenTelemetry Synchronous Instrument Helpers
|
||||||
|
|
||||||
- `otel.doubleCounter(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleCounter(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longCounter(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longCounter(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.doubleUpDownCounter(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleUpDownCounter(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longUpDownCounter(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longUpDownCounter(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.doubleValueRecorder(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleValueRecorder(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longValueRecorder(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longValueRecorder(String name, String description, String unit)`
|
||||||
|
|
||||||
These methods will return a new or previously registered instance of the applicable metric
|
These methods will return a new or previously registered instance of the applicable metric
|
||||||
instruments. Each one provides three additional signatures where labels, unit, and description
|
instruments. Each one provides three additional signatures where unit and description
|
||||||
aren't desired upon invocation.
|
aren't desired upon invocation.
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name, String description, String unit)` - `labels` are empty map.
|
- `otel.<meterMethod>(String name, String description)` - `unit` is "1".
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name, String description)` - `unit` is "1" and `labels` are empty map.
|
- `otel.<meterMethod>(String name)` - `description` is empty string and `unit` is "1".
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name)` - `description` is empty string, `unit` is "1" and `labels` are empty map.
|
|
||||||
|
|
||||||
### OpenTelemetry Asynchronous Instrument Helpers
|
### OpenTelemetry Asynchronous Instrument Helpers
|
||||||
|
|
||||||
- `otel.doubleSumObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleSumObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longSumObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longSumObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.doubleUpDownSumObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleUpDownSumObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longUpDownSumObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longUpDownSumObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.doubleValueObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.doubleValueObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
- `otel.longValueObserver(String name, String description, String unit, Map<String, String> labels)`
|
- `otel.longValueObserver(String name, String description, String unit)`
|
||||||
|
|
||||||
These methods will return a new or previously registered instance of the applicable metric
|
These methods will return a new or previously registered instance of the applicable metric
|
||||||
instruments. Each one provides three additional signatures where labels, unit, and description
|
instruments. Each one provides two additional signatures where unit and description aren't
|
||||||
aren't desired upon invocation.
|
desired upon invocation.
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name, String description, String unit)` - `labels` are empty map.
|
- `otel.<meterMethod>(String name, String description)` - `unit` is "1".
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name, String description)` - `unit` is "1" and `labels` are empty map.
|
- `otel.<meterMethod>(String name)` - `description` is empty string and `unit` is "1".
|
||||||
|
|
||||||
- `otel.<meterMethod>(String name)` - `description` is empty string, `unit` is "1" and `labels` are empty map.
|
|
||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
|
|
||||||
|
|
@ -164,12 +160,12 @@ file contents can also be provided via stdin on startup when using `-config -` a
|
||||||
| `otel.jmx.target.system` | if not using `otel.jmx.groovy.script` | The supported target application with built in Groovy script. |
|
| `otel.jmx.target.system` | if not using `otel.jmx.groovy.script` | The supported target application with built in Groovy script. |
|
||||||
| `otel.jmx.interval.milliseconds` | no | How often, in milliseconds, the Groovy script should be run and its resulting metrics exported. 10000 by default. |
|
| `otel.jmx.interval.milliseconds` | no | How often, in milliseconds, the Groovy script should be run and its resulting metrics exported. 10000 by default. |
|
||||||
| `otel.exporter` | no | The type of metric exporter to use: (`otlp`, `prometheus`, `inmemory`, `logging`). `logging` by default. |
|
| `otel.exporter` | no | The type of metric exporter to use: (`otlp`, `prometheus`, `inmemory`, `logging`). `logging` by default. |
|
||||||
| `otel.otlp.endpoint` | no | The otlp exporter endpoint to use, Required for `otlp`. |
|
| `otel.exporter.otlp.endpoint` | no | The otlp exporter endpoint to use, Required for `otlp`. |
|
||||||
| `otel.otlp.metric.timeout` | no | The otlp exporter request timeout (in milliseconds). Default is 1000. |
|
| `otel.exporter.otlp.metric.timeout` | no | The otlp exporter request timeout (in milliseconds). Default is 1000. |
|
||||||
| `otel.otlp.use.tls` | no | Whether to use TLS for otlp channel. Setting any value evaluates to `true`. |
|
| `otel.exporter.otlp.use.tls` | no | Whether to use TLS for otlp channel. Setting any value evaluates to `true`. |
|
||||||
| `otel.otlp.metadata` | no | Any headers to include in otlp exporter metric submissions. Of the form `'header1=value1;header2=value2'` |
|
| `otel.exporter.otlp.metadata` | no | Any headers to include in otlp exporter metric submissions. Of the form `'header1=value1;header2=value2'` |
|
||||||
| `otel.prometheus.host` | no | The prometheus collector server host. Default is `localhost`. |
|
| `otel.exporter.prometheus.host` | no | The prometheus collector server host. Default is `localhost`. |
|
||||||
| `otel.prometheus.port` | no | The prometheus collector server port. Default is `9090`. |
|
| `otel.exporter.prometheus.port` | no | The prometheus collector server port. Default is `9090`. |
|
||||||
| `otel.jmx.username` | no | Username for JMX authentication, if applicable. |
|
| `otel.jmx.username` | no | Username for JMX authentication, if applicable. |
|
||||||
| `otel.jmx.password` | no | Password for JMX authentication, if applicable. |
|
| `otel.jmx.password` | no | Password for JMX authentication, if applicable. |
|
||||||
| `javax.net.ssl.keyStore` | no | The key store path is required if client authentication is enabled on the target JVM. |
|
| `javax.net.ssl.keyStore` | no | The key store path is required if client authentication is enabled on the target JVM. |
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,8 @@ class OtelHelper {
|
||||||
return instrument(mBeanHelper, instrumentName, "", OtelHelper.SCALAR, [:] as Map<String, Closure>, attribute, otelInstrument)
|
return instrument(mBeanHelper, instrumentName, "", OtelHelper.SCALAR, [:] as Map<String, Closure>, attribute, otelInstrument)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleCounter doubleCounter(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleCounter(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleCounter doubleCounter(String name, String description, String unit) {
|
DoubleCounter doubleCounter(String name, String description, String unit) {
|
||||||
return doubleCounter(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleCounter(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleCounter doubleCounter(String name, String description) {
|
DoubleCounter doubleCounter(String name, String description) {
|
||||||
|
|
@ -123,12 +119,8 @@ class OtelHelper {
|
||||||
return doubleCounter(name, '')
|
return doubleCounter(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongCounter longCounter(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongCounter(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongCounter longCounter(String name, String description, String unit) {
|
LongCounter longCounter(String name, String description, String unit) {
|
||||||
return longCounter(name, description, unit, null)
|
return groovyMetricEnvironment.getLongCounter(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongCounter longCounter(String name, String description) {
|
LongCounter longCounter(String name, String description) {
|
||||||
|
|
@ -139,12 +131,8 @@ class OtelHelper {
|
||||||
return longCounter(name, '')
|
return longCounter(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleUpDownCounter doubleUpDownCounter(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleUpDownCounter(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleUpDownCounter doubleUpDownCounter(String name, String description, String unit) {
|
DoubleUpDownCounter doubleUpDownCounter(String name, String description, String unit) {
|
||||||
return doubleUpDownCounter(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleUpDownCounter(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleUpDownCounter doubleUpDownCounter(String name, String description) {
|
DoubleUpDownCounter doubleUpDownCounter(String name, String description) {
|
||||||
|
|
@ -155,12 +143,8 @@ class OtelHelper {
|
||||||
return doubleUpDownCounter(name, '')
|
return doubleUpDownCounter(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongUpDownCounter longUpDownCounter(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongUpDownCounter(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongUpDownCounter longUpDownCounter(String name, String description, String unit) {
|
LongUpDownCounter longUpDownCounter(String name, String description, String unit) {
|
||||||
return longUpDownCounter(name, description, unit, null)
|
return groovyMetricEnvironment.getLongUpDownCounter(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongUpDownCounter longUpDownCounter(String name, String description) {
|
LongUpDownCounter longUpDownCounter(String name, String description) {
|
||||||
|
|
@ -171,12 +155,8 @@ class OtelHelper {
|
||||||
return longUpDownCounter(name, '')
|
return longUpDownCounter(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleValueRecorder doubleValueRecorder(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleValueRecorder(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleValueRecorder doubleValueRecorder(String name, String description, String unit) {
|
DoubleValueRecorder doubleValueRecorder(String name, String description, String unit) {
|
||||||
return doubleValueRecorder(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleValueRecorder(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleValueRecorder doubleValueRecorder(String name, String description) {
|
DoubleValueRecorder doubleValueRecorder(String name, String description) {
|
||||||
|
|
@ -187,12 +167,8 @@ class OtelHelper {
|
||||||
return doubleValueRecorder(name, '')
|
return doubleValueRecorder(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongValueRecorder longValueRecorder(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongValueRecorder(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongValueRecorder longValueRecorder(String name, String description, String unit) {
|
LongValueRecorder longValueRecorder(String name, String description, String unit) {
|
||||||
return longValueRecorder(name, description, unit, null)
|
return groovyMetricEnvironment.getLongValueRecorder(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongValueRecorder longValueRecorder(String name, String description) {
|
LongValueRecorder longValueRecorder(String name, String description) {
|
||||||
|
|
@ -203,12 +179,8 @@ class OtelHelper {
|
||||||
return longValueRecorder(name, '')
|
return longValueRecorder(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleSumObserver doubleSumObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleSumObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleSumObserver doubleSumObserver(String name, String description, String unit) {
|
DoubleSumObserver doubleSumObserver(String name, String description, String unit) {
|
||||||
return doubleSumObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleSumObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleSumObserver doubleSumObserver(String name, String description) {
|
DoubleSumObserver doubleSumObserver(String name, String description) {
|
||||||
|
|
@ -219,12 +191,8 @@ class OtelHelper {
|
||||||
return doubleSumObserver(name, '')
|
return doubleSumObserver(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongSumObserver longSumObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongSumObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongSumObserver longSumObserver(String name, String description, String unit) {
|
LongSumObserver longSumObserver(String name, String description, String unit) {
|
||||||
return longSumObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getLongSumObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongSumObserver longSumObserver(String name, String description) {
|
LongSumObserver longSumObserver(String name, String description) {
|
||||||
|
|
@ -235,12 +203,8 @@ class OtelHelper {
|
||||||
return longSumObserver(name, '')
|
return longSumObserver(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleUpDownSumObserver doubleUpDownSumObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleUpDownSumObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleUpDownSumObserver doubleUpDownSumObserver(String name, String description, String unit) {
|
DoubleUpDownSumObserver doubleUpDownSumObserver(String name, String description, String unit) {
|
||||||
return doubleUpDownSumObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleUpDownSumObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleUpDownSumObserver doubleUpDownSumObserver(String name, String description) {
|
DoubleUpDownSumObserver doubleUpDownSumObserver(String name, String description) {
|
||||||
|
|
@ -251,12 +215,8 @@ class OtelHelper {
|
||||||
return doubleUpDownSumObserver(name, '')
|
return doubleUpDownSumObserver(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongUpDownSumObserver longUpDownSumObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongUpDownSumObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongUpDownSumObserver longUpDownSumObserver(String name, String description, String unit) {
|
LongUpDownSumObserver longUpDownSumObserver(String name, String description, String unit) {
|
||||||
return longUpDownSumObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getLongUpDownSumObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongUpDownSumObserver longUpDownSumObserver(String name, String description) {
|
LongUpDownSumObserver longUpDownSumObserver(String name, String description) {
|
||||||
|
|
@ -267,12 +227,8 @@ class OtelHelper {
|
||||||
return longUpDownSumObserver(name, '')
|
return longUpDownSumObserver(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleValueObserver doubleValueObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getDoubleValueObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
DoubleValueObserver doubleValueObserver(String name, String description, String unit) {
|
DoubleValueObserver doubleValueObserver(String name, String description, String unit) {
|
||||||
return doubleValueObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getDoubleValueObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
DoubleValueObserver doubleValueObserver(String name, String description) {
|
DoubleValueObserver doubleValueObserver(String name, String description) {
|
||||||
|
|
@ -283,12 +239,8 @@ class OtelHelper {
|
||||||
return doubleValueObserver(name, '')
|
return doubleValueObserver(name, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
LongValueObserver longValueObserver(String name, String description, String unit, Map<String, String> labels) {
|
|
||||||
return groovyMetricEnvironment.getLongValueObserver(name, description, unit, labels)
|
|
||||||
}
|
|
||||||
|
|
||||||
LongValueObserver longValueObserver(String name, String description, String unit) {
|
LongValueObserver longValueObserver(String name, String description, String unit) {
|
||||||
return longValueObserver(name, description, unit, null)
|
return groovyMetricEnvironment.getLongValueObserver(name, description, unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
LongValueObserver longValueObserver(String name, String description) {
|
LongValueObserver longValueObserver(String name, String description) {
|
||||||
|
|
|
||||||
|
|
@ -133,21 +133,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleCounter}
|
* @return new or memoized {@link DoubleCounter}
|
||||||
*/
|
*/
|
||||||
public DoubleCounter getDoubleCounter(
|
public DoubleCounter getDoubleCounter(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.doubleCounterBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.doubleCounterBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -156,21 +146,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongCounter}
|
* @return new or memoized {@link LongCounter}
|
||||||
*/
|
*/
|
||||||
public LongCounter getLongCounter(
|
public LongCounter getLongCounter(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.longCounterBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.longCounterBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -179,21 +159,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleUpDownCounter}
|
* @return new or memoized {@link DoubleUpDownCounter}
|
||||||
*/
|
*/
|
||||||
public DoubleUpDownCounter getDoubleUpDownCounter(
|
public DoubleUpDownCounter getDoubleUpDownCounter(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.doubleUpDownCounterBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.doubleUpDownCounterBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -202,21 +172,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongUpDownCounter}
|
* @return new or memoized {@link LongUpDownCounter}
|
||||||
*/
|
*/
|
||||||
public LongUpDownCounter getLongUpDownCounter(
|
public LongUpDownCounter getLongUpDownCounter(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.longUpDownCounterBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.longUpDownCounterBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -225,21 +185,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleValueRecorder}
|
* @return new or memoized {@link DoubleValueRecorder}
|
||||||
*/
|
*/
|
||||||
public DoubleValueRecorder getDoubleValueRecorder(
|
public DoubleValueRecorder getDoubleValueRecorder(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.doubleValueRecorderBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.doubleValueRecorderBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -248,21 +198,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongValueRecorder}
|
* @return new or memoized {@link LongValueRecorder}
|
||||||
*/
|
*/
|
||||||
public LongValueRecorder getLongValueRecorder(
|
public LongValueRecorder getLongValueRecorder(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.longValueRecorderBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.longValueRecorderBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -271,21 +211,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleSumObserver}
|
* @return new or memoized {@link DoubleSumObserver}
|
||||||
*/
|
*/
|
||||||
public DoubleSumObserver getDoubleSumObserver(
|
public DoubleSumObserver getDoubleSumObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.doubleSumObserverBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.doubleSumObserverBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -294,21 +224,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongSumObserver}
|
* @return new or memoized {@link LongSumObserver}
|
||||||
*/
|
*/
|
||||||
public LongSumObserver getLongSumObserver(
|
public LongSumObserver getLongSumObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.longSumObserverBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.longSumObserverBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -317,20 +237,14 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleUpDownSumObserver}
|
* @return new or memoized {@link DoubleUpDownSumObserver}
|
||||||
*/
|
*/
|
||||||
public DoubleUpDownSumObserver getDoubleUpDownSumObserver(
|
public DoubleUpDownSumObserver getDoubleUpDownSumObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
return meter
|
||||||
.doubleUpDownSumObserverBuilder(name)
|
.doubleUpDownSumObserverBuilder(name)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setUnit(unit)
|
.setUnit(unit)
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,20 +254,14 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongUpDownSumObserver}
|
* @return new or memoized {@link LongUpDownSumObserver}
|
||||||
*/
|
*/
|
||||||
public LongUpDownSumObserver getLongUpDownSumObserver(
|
public LongUpDownSumObserver getLongUpDownSumObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
return meter
|
||||||
.longUpDownSumObserverBuilder(name)
|
.longUpDownSumObserverBuilder(name)
|
||||||
.setDescription(description)
|
.setDescription(description)
|
||||||
.setUnit(unit)
|
.setUnit(unit)
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,21 +271,11 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link DoubleValueObserver}
|
* @return new or memoized {@link DoubleValueObserver}
|
||||||
*/
|
*/
|
||||||
public DoubleValueObserver getDoubleValueObserver(
|
public DoubleValueObserver getDoubleValueObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.doubleValueObserverBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.doubleValueObserverBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -386,20 +284,10 @@ public class GroovyMetricEnvironment {
|
||||||
* @param name - metric name
|
* @param name - metric name
|
||||||
* @param description metric description
|
* @param description metric description
|
||||||
* @param unit - metric unit
|
* @param unit - metric unit
|
||||||
* @param constantLabels - metric descriptor's constant labels
|
|
||||||
* @return new or memoized {@link LongValueObserver}
|
* @return new or memoized {@link LongValueObserver}
|
||||||
*/
|
*/
|
||||||
public LongValueObserver getLongValueObserver(
|
public LongValueObserver getLongValueObserver(
|
||||||
final String name,
|
final String name, final String description, final String unit) {
|
||||||
final String description,
|
return meter.longValueObserverBuilder(name).setDescription(description).setUnit(unit).build();
|
||||||
final String unit,
|
|
||||||
final Map<String, String> constantLabels) {
|
|
||||||
Labels labels = mapToLabels(constantLabels);
|
|
||||||
return meter
|
|
||||||
.longValueObserverBuilder(name)
|
|
||||||
.setDescription(description)
|
|
||||||
.setUnit(unit)
|
|
||||||
.setConstantLabels(labels)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,12 @@ class JmxConfig {
|
||||||
static final String TARGET_SYSTEM = PREFIX + "jmx.target.system";
|
static final String TARGET_SYSTEM = PREFIX + "jmx.target.system";
|
||||||
static final String INTERVAL_MILLISECONDS = PREFIX + "jmx.interval.milliseconds";
|
static final String INTERVAL_MILLISECONDS = PREFIX + "jmx.interval.milliseconds";
|
||||||
static final String EXPORTER_TYPE = PREFIX + "exporter";
|
static final String EXPORTER_TYPE = PREFIX + "exporter";
|
||||||
|
static final String EXPORTER = EXPORTER_TYPE + ".";
|
||||||
|
|
||||||
static final String OTLP_ENDPOINT = PREFIX + "otlp.endpoint";
|
static final String OTLP_ENDPOINT = EXPORTER + "otlp.endpoint";
|
||||||
|
|
||||||
static final String PROMETHEUS_HOST = PREFIX + "prometheus.host";
|
static final String PROMETHEUS_HOST = EXPORTER + "prometheus.host";
|
||||||
static final String PROMETHEUS_PORT = PREFIX + "prometheus.port";
|
static final String PROMETHEUS_PORT = EXPORTER + "prometheus.port";
|
||||||
|
|
||||||
static final String JMX_USERNAME = PREFIX + "jmx.username";
|
static final String JMX_USERNAME = PREFIX + "jmx.username";
|
||||||
static final String JMX_PASSWORD = PREFIX + "jmx.password";
|
static final String JMX_PASSWORD = PREFIX + "jmx.password";
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
package io.opentelemetry.contrib.jmxmetrics
|
package io.opentelemetry.contrib.jmxmetrics
|
||||||
|
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.SUMMARY
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.SUMMARY
|
||||||
import static java.lang.management.ManagementFactory.getPlatformMBeanServer
|
import static java.lang.management.ManagementFactory.getPlatformMBeanServer
|
||||||
|
|
||||||
import io.opentelemetry.common.Labels
|
import io.opentelemetry.common.Labels
|
||||||
|
|
@ -102,7 +102,7 @@ class InstrumentHelperTest extends Specification {
|
||||||
def s1 = p1.startEpochNanos
|
def s1 = p1.startEpochNanos
|
||||||
def s2 = p2.startEpochNanos
|
def s2 = p2.startEpochNanos
|
||||||
if (s1 == s2) {
|
if (s1 == s2) {
|
||||||
if (md1.descriptor.type == SUMMARY) {
|
if (md1.type == SUMMARY) {
|
||||||
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
||||||
}
|
}
|
||||||
return p1.value <=> p2.value
|
return p1.value <=> p2.value
|
||||||
|
|
@ -139,16 +139,15 @@ class InstrumentHelperTest extends Specification {
|
||||||
metrics.size() == 1
|
metrics.size() == 1
|
||||||
|
|
||||||
metrics.each { metric ->
|
metrics.each { metric ->
|
||||||
assert metric.descriptor.name == instrumentName
|
assert metric.name == instrumentName
|
||||||
assert metric.descriptor.description == description
|
assert metric.description == description
|
||||||
assert metric.descriptor.unit == "1"
|
assert metric.unit == "1"
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == metricType
|
||||||
assert metric.descriptor.type == descriptorType
|
|
||||||
assert metric.points.size() == isSingle ? 1 : 4
|
assert metric.points.size() == isSingle ? 1 : 4
|
||||||
metric.points.eachWithIndex { point, i ->
|
metric.points.eachWithIndex { point, i ->
|
||||||
assert point.labels == Labels.of("labelOne", "labelOneValue", "labelTwo", "${i}")
|
assert point.labels == Labels.of("labelOne", "labelOneValue", "labelTwo", "${i}")
|
||||||
|
|
||||||
if (descriptorType == SUMMARY) {
|
if (metricType == SUMMARY) {
|
||||||
assert point.count == 1
|
assert point.count == 1
|
||||||
assert point.sum == value
|
assert point.sum == value
|
||||||
assert point.percentileValues[0].percentile == 0
|
assert point.percentileValues[0].percentile == 0
|
||||||
|
|
@ -162,7 +161,7 @@ class InstrumentHelperTest extends Specification {
|
||||||
}
|
}
|
||||||
|
|
||||||
where:
|
where:
|
||||||
isSingle | quantity | attribute | instrumentMethod | descriptorType | value
|
isSingle | quantity | attribute | instrumentMethod | metricType | value
|
||||||
true | "single" | "Double" | "doubleCounter" | MONOTONIC_DOUBLE | 123.456
|
true | "single" | "Double" | "doubleCounter" | MONOTONIC_DOUBLE | 123.456
|
||||||
false | "multiple" | "Double" | "doubleCounter" | MONOTONIC_DOUBLE | 123.456
|
false | "multiple" | "Double" | "doubleCounter" | MONOTONIC_DOUBLE | 123.456
|
||||||
true | "single" | "Double" | "doubleUpDownCounter" | NON_MONOTONIC_DOUBLE | 123.456
|
true | "single" | "Double" | "doubleUpDownCounter" | NON_MONOTONIC_DOUBLE | 123.456
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class IntegrationTest extends Specification{
|
||||||
"/app/OpenTelemetryJava.jar",
|
"/app/OpenTelemetryJava.jar",
|
||||||
"-Dotel.jmx.username=cassandra",
|
"-Dotel.jmx.username=cassandra",
|
||||||
"-Dotel.jmx.password=cassandra",
|
"-Dotel.jmx.password=cassandra",
|
||||||
"-Dotel.otlp.endpoint=host.testcontainers.internal:${otlpPort}",
|
"-Dotel.exporter.otlp.endpoint=host.testcontainers.internal:${otlpPort}",
|
||||||
"io.opentelemetry.contrib.jmxmetrics.JmxMetrics",
|
"io.opentelemetry.contrib.jmxmetrics.JmxMetrics",
|
||||||
"-config",
|
"-config",
|
||||||
]
|
]
|
||||||
|
|
@ -120,7 +120,7 @@ class IntegrationTest extends Specification{
|
||||||
}
|
}
|
||||||
|
|
||||||
jmxExtensionAppContainer =
|
jmxExtensionAppContainer =
|
||||||
new GenericContainer<>("openjdk:7u111-jre-alpine")
|
new GenericContainer<>("openjdk:8u272-jre-slim")
|
||||||
.withNetwork(network)
|
.withNetwork(network)
|
||||||
.withCopyFileToContainer(MountableFile.forHostPath(jarPath), "/app/OpenTelemetryJava.jar")
|
.withCopyFileToContainer(MountableFile.forHostPath(jarPath), "/app/OpenTelemetryJava.jar")
|
||||||
.withCopyFileToContainer(
|
.withCopyFileToContainer(
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,9 @@ class JmxConfigTest extends UnitTest {
|
||||||
"jmx.target.system" : "mytargetsystem",
|
"jmx.target.system" : "mytargetsystem",
|
||||||
"jmx.interval.milliseconds": "123",
|
"jmx.interval.milliseconds": "123",
|
||||||
"exporter": "inmemory",
|
"exporter": "inmemory",
|
||||||
"otlp.endpoint": "myOtlpEndpoint",
|
"exporter.otlp.endpoint": "myOtlpEndpoint",
|
||||||
"prometheus.host": "myPrometheusHost",
|
"exporter.prometheus.host": "myPrometheusHost",
|
||||||
"prometheus.port": "234",
|
"exporter.prometheus.port": "234",
|
||||||
"jmx.username": "myUsername",
|
"jmx.username": "myUsername",
|
||||||
"jmx.password": "myPassword",
|
"jmx.password": "myPassword",
|
||||||
"jmx.remote.profile": "myRemoteProfile",
|
"jmx.remote.profile": "myRemoteProfile",
|
||||||
|
|
@ -94,7 +94,7 @@ class JmxConfigTest extends UnitTest {
|
||||||
where:
|
where:
|
||||||
prop | _
|
prop | _
|
||||||
'otel.jmx.interval.milliseconds' | _
|
'otel.jmx.interval.milliseconds' | _
|
||||||
'otel.prometheus.port' | _
|
'otel.exporter.prometheus.port' | _
|
||||||
}
|
}
|
||||||
|
|
||||||
def 'conflicting groovy script and target system'() {
|
def 'conflicting groovy script and target system'() {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
package io.opentelemetry.contrib.jmxmetrics
|
package io.opentelemetry.contrib.jmxmetrics
|
||||||
|
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.SUMMARY
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.SUMMARY
|
||||||
|
|
||||||
import io.opentelemetry.common.Labels
|
import io.opentelemetry.common.Labels
|
||||||
import io.opentelemetry.sdk.OpenTelemetrySdk
|
import io.opentelemetry.sdk.OpenTelemetrySdk
|
||||||
|
|
@ -61,7 +61,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def s1 = p1.startEpochNanos
|
def s1 = p1.startEpochNanos
|
||||||
def s2 = p2.startEpochNanos
|
def s2 = p2.startEpochNanos
|
||||||
if (s1 == s2) {
|
if (s1 == s2) {
|
||||||
if (md1.descriptor.type == SUMMARY) {
|
if (md1.type == SUMMARY) {
|
||||||
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
||||||
}
|
}
|
||||||
return p1.value <=> p2.value
|
return p1.value <=> p2.value
|
||||||
|
|
@ -74,8 +74,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.doubleSumObserver(
|
def dso = otel.doubleSumObserver(
|
||||||
'double-sum', 'a double sum',
|
'double-sum', 'a double sum',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({doubleResult ->
|
dso.setCallback({doubleResult ->
|
||||||
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -104,40 +103,34 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-sum'
|
assert first.name == 'double-sum'
|
||||||
assert first.descriptor.description == 'a double sum'
|
assert first.description == 'a double sum'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == MONOTONIC_DOUBLE
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123.456
|
assert first.points[0].value == 123.456
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-sum'
|
assert second.name == 'my-double-sum'
|
||||||
assert second.descriptor.description == 'another double sum'
|
assert second.description == 'another double sum'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == MONOTONIC_DOUBLE
|
||||||
assert second.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234.567
|
assert second.points[0].value == 234.567
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-sum'
|
assert third.name == 'another-double-sum'
|
||||||
assert third.descriptor.description == 'double sum'
|
assert third.description == 'double sum'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == MONOTONIC_DOUBLE
|
||||||
assert third.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345.678
|
assert third.points[0].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-sum'
|
assert fourth.name == 'yet-another-double-sum'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == MONOTONIC_DOUBLE
|
||||||
assert fourth.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456.789
|
assert fourth.points[0].value == 456.789
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -174,21 +167,19 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'double'
|
assert firstMetric.description == 'double'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == MONOTONIC_DOUBLE
|
||||||
assert firstMetric.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].value == 20.2
|
assert firstMetric.points[0].value == 20.2
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'double'
|
assert secondMetric.description == 'double'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == MONOTONIC_DOUBLE
|
||||||
assert secondMetric.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].value == 20.2
|
assert secondMetric.points[0].value == 20.2
|
||||||
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
@ -200,8 +191,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.longSumObserver(
|
def dso = otel.longSumObserver(
|
||||||
'long-sum', 'a long sum',
|
'long-sum', 'a long sum',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({longResult ->
|
dso.setCallback({longResult ->
|
||||||
longResult.observe(123, Labels.of('key', 'value'))
|
longResult.observe(123, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -230,40 +220,34 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-sum'
|
assert first.name == 'long-sum'
|
||||||
assert first.descriptor.description == 'a long sum'
|
assert first.description == 'a long sum'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == MONOTONIC_LONG
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123
|
assert first.points[0].value == 123
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-sum'
|
assert second.name == 'my-long-sum'
|
||||||
assert second.descriptor.description == 'another long sum'
|
assert second.description == 'another long sum'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == MONOTONIC_LONG
|
||||||
assert second.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234
|
assert second.points[0].value == 234
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-sum'
|
assert third.name == 'another-long-sum'
|
||||||
assert third.descriptor.description == 'long sum'
|
assert third.description == 'long sum'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == MONOTONIC_LONG
|
||||||
assert third.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345
|
assert third.points[0].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-sum'
|
assert fourth.name == 'yet-another-long-sum'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == MONOTONIC_LONG
|
||||||
assert fourth.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456
|
assert fourth.points[0].value == 456
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -300,21 +284,19 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'long'
|
assert firstMetric.description == 'long'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == MONOTONIC_LONG
|
||||||
assert firstMetric.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].value == 20
|
assert firstMetric.points[0].value == 20
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'long'
|
assert secondMetric.description == 'long'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == MONOTONIC_LONG
|
||||||
assert secondMetric.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].value == 20
|
assert secondMetric.points[0].value == 20
|
||||||
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
@ -326,8 +308,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.doubleUpDownSumObserver(
|
def dso = otel.doubleUpDownSumObserver(
|
||||||
'double-up-down-sum', 'a double up down sum',
|
'double-up-down-sum', 'a double up down sum',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({doubleResult ->
|
dso.setCallback({doubleResult ->
|
||||||
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -356,40 +337,34 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-up-down-sum'
|
assert first.name == 'double-up-down-sum'
|
||||||
assert first.descriptor.description == 'a double up down sum'
|
assert first.description == 'a double up down sum'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == NON_MONOTONIC_DOUBLE
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123.456
|
assert first.points[0].value == 123.456
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-up-down-sum'
|
assert second.name == 'my-double-up-down-sum'
|
||||||
assert second.descriptor.description == 'another double up down sum'
|
assert second.description == 'another double up down sum'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == NON_MONOTONIC_DOUBLE
|
||||||
assert second.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234.567
|
assert second.points[0].value == 234.567
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-up-down-sum'
|
assert third.name == 'another-double-up-down-sum'
|
||||||
assert third.descriptor.description == 'double up down sum'
|
assert third.description == 'double up down sum'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == NON_MONOTONIC_DOUBLE
|
||||||
assert third.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345.678
|
assert third.points[0].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-up-down-sum'
|
assert fourth.name == 'yet-another-double-up-down-sum'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == NON_MONOTONIC_DOUBLE
|
||||||
assert fourth.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456.789
|
assert fourth.points[0].value == 456.789
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -426,21 +401,19 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'double'
|
assert firstMetric.description == 'double'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == NON_MONOTONIC_DOUBLE
|
||||||
assert firstMetric.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].value == 20.2
|
assert firstMetric.points[0].value == 20.2
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'double'
|
assert secondMetric.description == 'double'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == NON_MONOTONIC_DOUBLE
|
||||||
assert secondMetric.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].value == 20.2
|
assert secondMetric.points[0].value == 20.2
|
||||||
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
@ -452,8 +425,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.longUpDownSumObserver(
|
def dso = otel.longUpDownSumObserver(
|
||||||
'long-up-down-sum', 'a long up down sum',
|
'long-up-down-sum', 'a long up down sum',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({longResult ->
|
dso.setCallback({longResult ->
|
||||||
longResult.observe(123, Labels.of('key', 'value'))
|
longResult.observe(123, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -482,40 +454,34 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-up-down-sum'
|
assert first.name == 'long-up-down-sum'
|
||||||
assert first.descriptor.description == 'a long up down sum'
|
assert first.description == 'a long up down sum'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == NON_MONOTONIC_LONG
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123
|
assert first.points[0].value == 123
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-up-down-sum'
|
assert second.name == 'my-long-up-down-sum'
|
||||||
assert second.descriptor.description == 'another long up down sum'
|
assert second.description == 'another long up down sum'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == NON_MONOTONIC_LONG
|
||||||
assert second.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234
|
assert second.points[0].value == 234
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-up-down-sum'
|
assert third.name == 'another-long-up-down-sum'
|
||||||
assert third.descriptor.description == 'long up down sum'
|
assert third.description == 'long up down sum'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == NON_MONOTONIC_LONG
|
||||||
assert third.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345
|
assert third.points[0].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-up-down-sum'
|
assert fourth.name == 'yet-another-long-up-down-sum'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == NON_MONOTONIC_LONG
|
||||||
assert fourth.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456
|
assert fourth.points[0].value == 456
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -552,21 +518,19 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'long'
|
assert firstMetric.description == 'long'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == NON_MONOTONIC_LONG
|
||||||
assert firstMetric.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].value == 20
|
assert firstMetric.points[0].value == 20
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'long'
|
assert secondMetric.description == 'long'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == NON_MONOTONIC_LONG
|
||||||
assert secondMetric.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].value == 20
|
assert secondMetric.points[0].value == 20
|
||||||
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert secondMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
@ -578,8 +542,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.doubleValueObserver(
|
def dso = otel.doubleValueObserver(
|
||||||
'double-value', 'a double value',
|
'double-value', 'a double value',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({doubleResult ->
|
dso.setCallback({doubleResult ->
|
||||||
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
doubleResult.observe(123.456, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -608,13 +571,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-value'
|
assert first.name == 'double-value'
|
||||||
assert first.descriptor.description == 'a double value'
|
assert first.description == 'a double value'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == SUMMARY
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == SUMMARY
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].count == 1
|
assert first.points[0].count == 1
|
||||||
assert first.points[0].sum == 123.456
|
assert first.points[0].sum == 123.456
|
||||||
|
|
@ -624,11 +584,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert first.points[0].percentileValues[1].value == 123.456
|
assert first.points[0].percentileValues[1].value == 123.456
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-value'
|
assert second.name == 'my-double-value'
|
||||||
assert second.descriptor.description == 'another double value'
|
assert second.description == 'another double value'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == SUMMARY
|
||||||
assert second.descriptor.type == SUMMARY
|
|
||||||
assert second.points[0].count == 1
|
assert second.points[0].count == 1
|
||||||
assert second.points[0].sum == 234.567
|
assert second.points[0].sum == 234.567
|
||||||
assert second.points[0].percentileValues[0].percentile == 0
|
assert second.points[0].percentileValues[0].percentile == 0
|
||||||
|
|
@ -637,11 +596,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert second.points[0].percentileValues[1].value == 234.567
|
assert second.points[0].percentileValues[1].value == 234.567
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-value'
|
assert third.name == 'another-double-value'
|
||||||
assert third.descriptor.description == 'double value'
|
assert third.description == 'double value'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == SUMMARY
|
||||||
assert third.descriptor.type == SUMMARY
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].count == 1
|
assert third.points[0].count == 1
|
||||||
assert third.points[0].sum == 345.678
|
assert third.points[0].sum == 345.678
|
||||||
|
|
@ -651,11 +609,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert third.points[0].percentileValues[1].value == 345.678
|
assert third.points[0].percentileValues[1].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-value'
|
assert fourth.name == 'yet-another-double-value'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == SUMMARY
|
||||||
assert fourth.descriptor.type == SUMMARY
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].count == 1
|
assert fourth.points[0].count == 1
|
||||||
assert fourth.points[0].sum == 456.789
|
assert fourth.points[0].sum == 456.789
|
||||||
|
|
@ -698,11 +655,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'double'
|
assert firstMetric.description == 'double'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == SUMMARY
|
||||||
assert firstMetric.descriptor.type == SUMMARY
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].count == 1
|
assert firstMetric.points[0].count == 1
|
||||||
assert firstMetric.points[0].sum == 20.2
|
assert firstMetric.points[0].sum == 20.2
|
||||||
|
|
@ -713,11 +669,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'double'
|
assert secondMetric.description == 'double'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == SUMMARY
|
||||||
assert secondMetric.descriptor.type == SUMMARY
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].count == 1
|
assert secondMetric.points[0].count == 1
|
||||||
assert secondMetric.points[0].sum == 40.4
|
assert secondMetric.points[0].sum == 40.4
|
||||||
|
|
@ -739,8 +694,7 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dso = otel.longValueObserver(
|
def dso = otel.longValueObserver(
|
||||||
'long-value', 'a long value',
|
'long-value', 'a long value',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dso.setCallback({longResult ->
|
dso.setCallback({longResult ->
|
||||||
longResult.observe(123, Labels.of('key', 'value'))
|
longResult.observe(123, Labels.of('key', 'value'))
|
||||||
})
|
})
|
||||||
|
|
@ -769,13 +723,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-value'
|
assert first.name == 'long-value'
|
||||||
assert first.descriptor.description == 'a long value'
|
assert first.description == 'a long value'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == SUMMARY
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == SUMMARY
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].count == 1
|
assert first.points[0].count == 1
|
||||||
assert first.points[0].sum == 123
|
assert first.points[0].sum == 123
|
||||||
|
|
@ -785,11 +736,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert first.points[0].percentileValues[1].value == 123
|
assert first.points[0].percentileValues[1].value == 123
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-value'
|
assert second.name == 'my-long-value'
|
||||||
assert second.descriptor.description == 'another long value'
|
assert second.description == 'another long value'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == SUMMARY
|
||||||
assert second.descriptor.type == SUMMARY
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].count == 1
|
assert second.points[0].count == 1
|
||||||
assert second.points[0].sum == 234
|
assert second.points[0].sum == 234
|
||||||
|
|
@ -799,11 +749,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert second.points[0].percentileValues[1].value == 234
|
assert second.points[0].percentileValues[1].value == 234
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-value'
|
assert third.name == 'another-long-value'
|
||||||
assert third.descriptor.description == 'long value'
|
assert third.description == 'long value'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == SUMMARY
|
||||||
assert third.descriptor.type == SUMMARY
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].count == 1
|
assert third.points[0].count == 1
|
||||||
assert third.points[0].sum == 345
|
assert third.points[0].sum == 345
|
||||||
|
|
@ -813,11 +762,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert third.points[0].percentileValues[1].value == 345
|
assert third.points[0].percentileValues[1].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-value'
|
assert fourth.name == 'yet-another-long-value'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == SUMMARY
|
||||||
assert fourth.descriptor.type == SUMMARY
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].count == 1
|
assert fourth.points[0].count == 1
|
||||||
assert fourth.points[0].sum == 456
|
assert fourth.points[0].sum == 456
|
||||||
|
|
@ -860,11 +808,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert secondMetrics.size() == 1
|
assert secondMetrics.size() == 1
|
||||||
|
|
||||||
def firstMetric = firstMetrics[0]
|
def firstMetric = firstMetrics[0]
|
||||||
assert firstMetric.descriptor.name == 'dc'
|
assert firstMetric.name == 'dc'
|
||||||
assert firstMetric.descriptor.description == 'long'
|
assert firstMetric.description == 'long'
|
||||||
assert firstMetric.descriptor.unit == '1'
|
assert firstMetric.unit == '1'
|
||||||
assert firstMetric.descriptor.constantLabels == Labels.empty()
|
assert firstMetric.type == SUMMARY
|
||||||
assert firstMetric.descriptor.type == SUMMARY
|
|
||||||
assert firstMetric.points.size() == 1
|
assert firstMetric.points.size() == 1
|
||||||
assert firstMetric.points[0].sum == 20
|
assert firstMetric.points[0].sum == 20
|
||||||
assert firstMetric.points[0].percentileValues[0].percentile == 0
|
assert firstMetric.points[0].percentileValues[0].percentile == 0
|
||||||
|
|
@ -874,11 +821,10 @@ class OtelHelperAsynchronousMetricTest extends Specification{
|
||||||
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
assert firstMetric.points[0].labels == Labels.of('key2', 'value2')
|
||||||
|
|
||||||
def secondMetric = secondMetrics[0]
|
def secondMetric = secondMetrics[0]
|
||||||
assert secondMetric.descriptor.name == 'dc'
|
assert secondMetric.name == 'dc'
|
||||||
assert secondMetric.descriptor.description == 'long'
|
assert secondMetric.description == 'long'
|
||||||
assert secondMetric.descriptor.unit == '1'
|
assert secondMetric.unit == '1'
|
||||||
assert secondMetric.descriptor.constantLabels == Labels.empty()
|
assert secondMetric.type == SUMMARY
|
||||||
assert secondMetric.descriptor.type == SUMMARY
|
|
||||||
assert secondMetric.points.size() == 2
|
assert secondMetric.points.size() == 2
|
||||||
assert secondMetric.points[0].sum == 40
|
assert secondMetric.points[0].sum == 40
|
||||||
assert secondMetric.points[0].percentileValues[0].percentile == 0
|
assert secondMetric.points[0].percentileValues[0].percentile == 0
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
package io.opentelemetry.contrib.jmxmetrics
|
package io.opentelemetry.contrib.jmxmetrics
|
||||||
|
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_DOUBLE
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_DOUBLE
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.NON_MONOTONIC_LONG
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.NON_MONOTONIC_LONG
|
||||||
import static io.opentelemetry.sdk.metrics.data.MetricData.Descriptor.Type.SUMMARY
|
import static io.opentelemetry.sdk.metrics.data.MetricData.Type.SUMMARY
|
||||||
|
|
||||||
import io.opentelemetry.common.Labels
|
import io.opentelemetry.common.Labels
|
||||||
import io.opentelemetry.sdk.OpenTelemetrySdk
|
import io.opentelemetry.sdk.OpenTelemetrySdk
|
||||||
|
|
@ -60,7 +60,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def s1 = p1.startEpochNanos
|
def s1 = p1.startEpochNanos
|
||||||
def s2 = p2.startEpochNanos
|
def s2 = p2.startEpochNanos
|
||||||
if (s1 == s2) {
|
if (s1 == s2) {
|
||||||
if (md1.descriptor.type == SUMMARY) {
|
if (md1.type == SUMMARY) {
|
||||||
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
return p1.percentileValues[0].value <=> p2.percentileValues[0].value
|
||||||
}
|
}
|
||||||
return p1.value <=> p2.value
|
return p1.value <=> p2.value
|
||||||
|
|
@ -73,8 +73,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dc = otel.doubleCounter(
|
def dc = otel.doubleCounter(
|
||||||
'double-counter', 'a double counter',
|
'double-counter', 'a double counter',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dc.add(123.456, Labels.of('key', 'value'))
|
dc.add(123.456, Labels.of('key', 'value'))
|
||||||
|
|
||||||
dc = otel.doubleCounter('my-double-counter', 'another double counter', 'µs')
|
dc = otel.doubleCounter('my-double-counter', 'another double counter', 'µs')
|
||||||
|
|
@ -95,40 +94,34 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-counter'
|
assert first.name == 'double-counter'
|
||||||
assert first.descriptor.description == 'a double counter'
|
assert first.description == 'a double counter'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == MONOTONIC_DOUBLE
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123.456
|
assert first.points[0].value == 123.456
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-counter'
|
assert second.name == 'my-double-counter'
|
||||||
assert second.descriptor.description == 'another double counter'
|
assert second.description == 'another double counter'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == MONOTONIC_DOUBLE
|
||||||
assert second.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234.567
|
assert second.points[0].value == 234.567
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-counter'
|
assert third.name == 'another-double-counter'
|
||||||
assert third.descriptor.description == 'double counter'
|
assert third.description == 'double counter'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == MONOTONIC_DOUBLE
|
||||||
assert third.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345.678
|
assert third.points[0].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-counter'
|
assert fourth.name == 'yet-another-double-counter'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == MONOTONIC_DOUBLE
|
||||||
assert fourth.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456.789
|
assert fourth.points[0].value == 456.789
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -148,11 +141,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'dc'
|
assert metric.name == 'dc'
|
||||||
assert metric.descriptor.description == 'double'
|
assert metric.description == 'double'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == MONOTONIC_DOUBLE
|
||||||
assert metric.descriptor.type == MONOTONIC_DOUBLE
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].value == 20.2
|
assert metric.points[0].value == 20.2
|
||||||
assert metric.points[0].labels == Labels.of('key', 'value')
|
assert metric.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
@ -162,8 +154,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def lc = otel.longCounter(
|
def lc = otel.longCounter(
|
||||||
'long-counter', 'a long counter',
|
'long-counter', 'a long counter',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
lc.add(123, Labels.of('key', 'value'))
|
lc.add(123, Labels.of('key', 'value'))
|
||||||
|
|
||||||
lc = otel.longCounter('my-long-counter', 'another long counter', 'µs')
|
lc = otel.longCounter('my-long-counter', 'another long counter', 'µs')
|
||||||
|
|
@ -184,40 +175,34 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-counter'
|
assert first.name == 'long-counter'
|
||||||
assert first.descriptor.description == 'a long counter'
|
assert first.description == 'a long counter'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == MONOTONIC_LONG
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == 123
|
assert first.points[0].value == 123
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-counter'
|
assert second.name == 'my-long-counter'
|
||||||
assert second.descriptor.description == 'another long counter'
|
assert second.description == 'another long counter'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == MONOTONIC_LONG
|
||||||
assert second.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == 234
|
assert second.points[0].value == 234
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-counter'
|
assert third.name == 'another-long-counter'
|
||||||
assert third.descriptor.description == 'long counter'
|
assert third.description == 'long counter'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == MONOTONIC_LONG
|
||||||
assert third.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345
|
assert third.points[0].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-counter'
|
assert fourth.name == 'yet-another-long-counter'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == MONOTONIC_LONG
|
||||||
assert fourth.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456
|
assert fourth.points[0].value == 456
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -237,11 +222,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'lc'
|
assert metric.name == 'lc'
|
||||||
assert metric.descriptor.description == 'long'
|
assert metric.description == 'long'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == MONOTONIC_LONG
|
||||||
assert metric.descriptor.type == MONOTONIC_LONG
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].value == 20
|
assert metric.points[0].value == 20
|
||||||
assert metric.points[0].labels == Labels.of('key', 'value')
|
assert metric.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
@ -251,8 +235,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dudc = otel.doubleUpDownCounter(
|
def dudc = otel.doubleUpDownCounter(
|
||||||
'double-up-down-counter', 'a double up-down-counter',
|
'double-up-down-counter', 'a double up-down-counter',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dudc.add(-234.567, Labels.of('key', 'value'))
|
dudc.add(-234.567, Labels.of('key', 'value'))
|
||||||
|
|
||||||
dudc = otel.doubleUpDownCounter('my-double-up-down-counter', 'another double up-down-counter', 'µs')
|
dudc = otel.doubleUpDownCounter('my-double-up-down-counter', 'another double up-down-counter', 'µs')
|
||||||
|
|
@ -273,40 +256,34 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-up-down-counter'
|
assert first.name == 'double-up-down-counter'
|
||||||
assert first.descriptor.description == 'a double up-down-counter'
|
assert first.description == 'a double up-down-counter'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == NON_MONOTONIC_DOUBLE
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == -234.567
|
assert first.points[0].value == -234.567
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-up-down-counter'
|
assert second.name == 'my-double-up-down-counter'
|
||||||
assert second.descriptor.description == 'another double up-down-counter'
|
assert second.description == 'another double up-down-counter'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == NON_MONOTONIC_DOUBLE
|
||||||
assert second.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == -123.456
|
assert second.points[0].value == -123.456
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-up-down-counter'
|
assert third.name == 'another-double-up-down-counter'
|
||||||
assert third.descriptor.description == 'double up-down-counter'
|
assert third.description == 'double up-down-counter'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == NON_MONOTONIC_DOUBLE
|
||||||
assert third.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345.678
|
assert third.points[0].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-up-down-counter'
|
assert fourth.name == 'yet-another-double-up-down-counter'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == NON_MONOTONIC_DOUBLE
|
||||||
assert fourth.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456.789
|
assert fourth.points[0].value == 456.789
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -326,11 +303,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'dudc'
|
assert metric.name == 'dudc'
|
||||||
assert metric.descriptor.description == 'double up down'
|
assert metric.description == 'double up down'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == NON_MONOTONIC_DOUBLE
|
||||||
assert metric.descriptor.type == NON_MONOTONIC_DOUBLE
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].value == 0
|
assert metric.points[0].value == 0
|
||||||
assert metric.points[0].labels == Labels.of('key', 'value')
|
assert metric.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
@ -340,8 +316,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def ludc = otel.longUpDownCounter(
|
def ludc = otel.longUpDownCounter(
|
||||||
'long-up-down-counter', 'a long up-down-counter',
|
'long-up-down-counter', 'a long up-down-counter',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
ludc.add(-234, Labels.of('key', 'value'))
|
ludc.add(-234, Labels.of('key', 'value'))
|
||||||
|
|
||||||
ludc = otel.longUpDownCounter('my-long-up-down-counter', 'another long up-down-counter', 'µs')
|
ludc = otel.longUpDownCounter('my-long-up-down-counter', 'another long up-down-counter', 'µs')
|
||||||
|
|
@ -362,40 +337,34 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-up-down-counter'
|
assert first.name == 'long-up-down-counter'
|
||||||
assert first.descriptor.description == 'a long up-down-counter'
|
assert first.description == 'a long up-down-counter'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == NON_MONOTONIC_LONG
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].value == -234
|
assert first.points[0].value == -234
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-up-down-counter'
|
assert second.name == 'my-long-up-down-counter'
|
||||||
assert second.descriptor.description == 'another long up-down-counter'
|
assert second.description == 'another long up-down-counter'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == NON_MONOTONIC_LONG
|
||||||
assert second.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].value == -123
|
assert second.points[0].value == -123
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-up-down-counter'
|
assert third.name == 'another-long-up-down-counter'
|
||||||
assert third.descriptor.description == 'long up-down-counter'
|
assert third.description == 'long up-down-counter'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == NON_MONOTONIC_LONG
|
||||||
assert third.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].value == 345
|
assert third.points[0].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-up-down-counter'
|
assert fourth.name == 'yet-another-long-up-down-counter'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == NON_MONOTONIC_LONG
|
||||||
assert fourth.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].value == 456
|
assert fourth.points[0].value == 456
|
||||||
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
assert fourth.points[0].labels == Labels.of('yetAnotherKey', 'yetAnotherValue')
|
||||||
|
|
@ -415,11 +384,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'ludc'
|
assert metric.name == 'ludc'
|
||||||
assert metric.descriptor.description == 'long up down'
|
assert metric.description == 'long up down'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == NON_MONOTONIC_LONG
|
||||||
assert metric.descriptor.type == NON_MONOTONIC_LONG
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].value == 0
|
assert metric.points[0].value == 0
|
||||||
assert metric.points[0].labels == Labels.of('key', 'value')
|
assert metric.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
@ -429,8 +397,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def dvr = otel.doubleValueRecorder(
|
def dvr = otel.doubleValueRecorder(
|
||||||
'double-value-recorder', 'a double value-recorder',
|
'double-value-recorder', 'a double value-recorder',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
dvr.record(-234.567, Labels.of('key', 'value'))
|
dvr.record(-234.567, Labels.of('key', 'value'))
|
||||||
|
|
||||||
dvr = otel.doubleValueRecorder('my-double-value-recorder', 'another double value-recorder', 'µs')
|
dvr = otel.doubleValueRecorder('my-double-value-recorder', 'another double value-recorder', 'µs')
|
||||||
|
|
@ -451,13 +418,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'double-value-recorder'
|
assert first.name == 'double-value-recorder'
|
||||||
assert first.descriptor.description == 'a double value-recorder'
|
assert first.description == 'a double value-recorder'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == SUMMARY
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == SUMMARY
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].count == 1
|
assert first.points[0].count == 1
|
||||||
assert first.points[0].sum == -234.567
|
assert first.points[0].sum == -234.567
|
||||||
|
|
@ -467,11 +431,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert first.points[0].percentileValues[1].value == -234.567
|
assert first.points[0].percentileValues[1].value == -234.567
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-double-value-recorder'
|
assert second.name == 'my-double-value-recorder'
|
||||||
assert second.descriptor.description == 'another double value-recorder'
|
assert second.description == 'another double value-recorder'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == SUMMARY
|
||||||
assert second.descriptor.type == SUMMARY
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].count == 1
|
assert second.points[0].count == 1
|
||||||
assert second.points[0].sum == -123.456
|
assert second.points[0].sum == -123.456
|
||||||
|
|
@ -481,11 +444,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert second.points[0].percentileValues[1].value == -123.456
|
assert second.points[0].percentileValues[1].value == -123.456
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-double-value-recorder'
|
assert third.name == 'another-double-value-recorder'
|
||||||
assert third.descriptor.description == 'double value-recorder'
|
assert third.description == 'double value-recorder'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == SUMMARY
|
||||||
assert third.descriptor.type == SUMMARY
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].count == 1
|
assert third.points[0].count == 1
|
||||||
assert third.points[0].sum == 345.678
|
assert third.points[0].sum == 345.678
|
||||||
|
|
@ -495,11 +457,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert third.points[0].percentileValues[1].value == 345.678
|
assert third.points[0].percentileValues[1].value == 345.678
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-double-value-recorder'
|
assert fourth.name == 'yet-another-double-value-recorder'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == SUMMARY
|
||||||
assert fourth.descriptor.type == SUMMARY
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].count == 1
|
assert fourth.points[0].count == 1
|
||||||
assert fourth.points[0].sum == 456.789
|
assert fourth.points[0].sum == 456.789
|
||||||
|
|
@ -524,11 +485,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'dvr'
|
assert metric.name == 'dvr'
|
||||||
assert metric.descriptor.description == 'double value'
|
assert metric.description == 'double value'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == SUMMARY
|
||||||
assert metric.descriptor.type == SUMMARY
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].count == 2
|
assert metric.points[0].count == 2
|
||||||
assert metric.points[0].sum == 0
|
assert metric.points[0].sum == 0
|
||||||
|
|
@ -543,8 +503,7 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
when:
|
when:
|
||||||
def lvr = otel.longValueRecorder(
|
def lvr = otel.longValueRecorder(
|
||||||
'long-value-recorder', 'a long value-recorder',
|
'long-value-recorder', 'a long value-recorder',
|
||||||
'ms', [key1:'value1', key2:'value2']
|
'ms')
|
||||||
)
|
|
||||||
lvr.record(-234, Labels.of('key', 'value'))
|
lvr.record(-234, Labels.of('key', 'value'))
|
||||||
|
|
||||||
lvr = otel.longValueRecorder('my-long-value-recorder', 'another long value-recorder', 'µs')
|
lvr = otel.longValueRecorder('my-long-value-recorder', 'another long value-recorder', 'µs')
|
||||||
|
|
@ -565,13 +524,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
def third = metrics[2]
|
def third = metrics[2]
|
||||||
def fourth = metrics[3]
|
def fourth = metrics[3]
|
||||||
|
|
||||||
assert first.descriptor.name == 'long-value-recorder'
|
assert first.name == 'long-value-recorder'
|
||||||
assert first.descriptor.description == 'a long value-recorder'
|
assert first.description == 'a long value-recorder'
|
||||||
assert first.descriptor.unit == 'ms'
|
assert first.unit == 'ms'
|
||||||
assert first.descriptor.constantLabels == Labels.of(
|
assert first.type == SUMMARY
|
||||||
'key1', 'value1', 'key2', 'value2'
|
|
||||||
)
|
|
||||||
assert first.descriptor.type == SUMMARY
|
|
||||||
assert first.points.size() == 1
|
assert first.points.size() == 1
|
||||||
assert first.points[0].count == 1
|
assert first.points[0].count == 1
|
||||||
assert first.points[0].sum == -234
|
assert first.points[0].sum == -234
|
||||||
|
|
@ -581,11 +537,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert first.points[0].percentileValues[1].value == -234
|
assert first.points[0].percentileValues[1].value == -234
|
||||||
assert first.points[0].labels == Labels.of('key', 'value')
|
assert first.points[0].labels == Labels.of('key', 'value')
|
||||||
|
|
||||||
assert second.descriptor.name == 'my-long-value-recorder'
|
assert second.name == 'my-long-value-recorder'
|
||||||
assert second.descriptor.description == 'another long value-recorder'
|
assert second.description == 'another long value-recorder'
|
||||||
assert second.descriptor.unit == 'µs'
|
assert second.unit == 'µs'
|
||||||
assert second.descriptor.constantLabels == Labels.empty()
|
assert second.type == SUMMARY
|
||||||
assert second.descriptor.type == SUMMARY
|
|
||||||
assert second.points.size() == 1
|
assert second.points.size() == 1
|
||||||
assert second.points[0].count == 1
|
assert second.points[0].count == 1
|
||||||
assert second.points[0].sum == -123
|
assert second.points[0].sum == -123
|
||||||
|
|
@ -595,11 +550,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert second.points[0].percentileValues[1].value == -123
|
assert second.points[0].percentileValues[1].value == -123
|
||||||
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
assert second.points[0].labels == Labels.of('myKey', 'myValue')
|
||||||
|
|
||||||
assert third.descriptor.name == 'another-long-value-recorder'
|
assert third.name == 'another-long-value-recorder'
|
||||||
assert third.descriptor.description == 'long value-recorder'
|
assert third.description == 'long value-recorder'
|
||||||
assert third.descriptor.unit == '1'
|
assert third.unit == '1'
|
||||||
assert third.descriptor.constantLabels == Labels.empty()
|
assert third.type == SUMMARY
|
||||||
assert third.descriptor.type == SUMMARY
|
|
||||||
assert third.points.size() == 1
|
assert third.points.size() == 1
|
||||||
assert third.points[0].count == 1
|
assert third.points[0].count == 1
|
||||||
assert third.points[0].sum == 345
|
assert third.points[0].sum == 345
|
||||||
|
|
@ -609,11 +563,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert third.points[0].percentileValues[1].value == 345
|
assert third.points[0].percentileValues[1].value == 345
|
||||||
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
assert third.points[0].labels == Labels.of('anotherKey', 'anotherValue')
|
||||||
|
|
||||||
assert fourth.descriptor.name == 'yet-another-long-value-recorder'
|
assert fourth.name == 'yet-another-long-value-recorder'
|
||||||
assert fourth.descriptor.description == ''
|
assert fourth.description == ''
|
||||||
assert fourth.descriptor.unit == '1'
|
assert fourth.unit == '1'
|
||||||
assert fourth.descriptor.constantLabels == Labels.empty()
|
assert fourth.type == SUMMARY
|
||||||
assert fourth.descriptor.type == SUMMARY
|
|
||||||
assert fourth.points.size() == 1
|
assert fourth.points.size() == 1
|
||||||
assert fourth.points[0].count == 1
|
assert fourth.points[0].count == 1
|
||||||
assert fourth.points[0].sum == 456
|
assert fourth.points[0].sum == 456
|
||||||
|
|
@ -638,11 +591,10 @@ class OtelHelperSynchronousMetricTest extends Specification{
|
||||||
assert metrics.size() == 1
|
assert metrics.size() == 1
|
||||||
def metric = metrics[0]
|
def metric = metrics[0]
|
||||||
|
|
||||||
assert metric.descriptor.name == 'lvr'
|
assert metric.name == 'lvr'
|
||||||
assert metric.descriptor.description == 'long value'
|
assert metric.description == 'long value'
|
||||||
assert metric.descriptor.unit == '1'
|
assert metric.unit == '1'
|
||||||
assert metric.descriptor.constantLabels == Labels.empty()
|
assert metric.type == SUMMARY
|
||||||
assert metric.descriptor.type == SUMMARY
|
|
||||||
assert metric.points.size() == 1
|
assert metric.points.size() == 1
|
||||||
assert metric.points[0].count == 2
|
assert metric.points[0].count == 2
|
||||||
assert metric.points[0].sum == 0
|
assert metric.points[0].sum == 0
|
||||||
|
|
|
||||||
|
|
@ -24,20 +24,20 @@ class UnitTest extends Specification {
|
||||||
void clearProperties() {
|
void clearProperties() {
|
||||||
// ensure relevant properties aren't set
|
// ensure relevant properties aren't set
|
||||||
def properties = [
|
def properties = [
|
||||||
"jmx.service.url",
|
JmxConfig.SERVICE_URL,
|
||||||
"jmx.groovy.script",
|
JmxConfig.GROOVY_SCRIPT,
|
||||||
"jmx.target.system",
|
JmxConfig.TARGET_SYSTEM,
|
||||||
"jmx.interval.milliseconds",
|
JmxConfig.INTERVAL_MILLISECONDS,
|
||||||
"exporter",
|
JmxConfig.EXPORTER_TYPE,
|
||||||
"otlp.endpoint",
|
JmxConfig.OTLP_ENDPOINT,
|
||||||
"prometheus.host",
|
JmxConfig.PROMETHEUS_HOST,
|
||||||
"prometheus.port",
|
JmxConfig.PROMETHEUS_PORT,
|
||||||
"jmx.username",
|
JmxConfig.JMX_USERNAME,
|
||||||
"jmx.password",
|
JmxConfig.JMX_PASSWORD,
|
||||||
"jmx.remote.profile",
|
JmxConfig.JMX_REMOTE_PROFILE,
|
||||||
"jmx.realm"
|
JmxConfig.JMX_REALM
|
||||||
]
|
]
|
||||||
properties.each {System.clearProperty("otel.${it}")}
|
properties.each {System.clearProperty(it)}
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ otel.jmx.groovy.script = /app/script.groovy
|
||||||
# these will be overridden by cmd line
|
# these will be overridden by cmd line
|
||||||
otel.jmx.username = wrong_username
|
otel.jmx.username = wrong_username
|
||||||
otel.jmx.password = wrong_password
|
otel.jmx.password = wrong_password
|
||||||
otel.otlp.endpoint = host.testcontainers.internal:80
|
otel.exporter.otlp.endpoint = host.testcontainers.internal:80
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
otel.jmx.interval.milliseconds = 3000
|
otel.jmx.interval.milliseconds = 3000
|
||||||
otel.exporter = prometheus
|
otel.exporter = prometheus
|
||||||
otel.prometheus.host = 0.0.0.0
|
otel.exporter.prometheus.host = 0.0.0.0
|
||||||
otel.prometheus.port = 9123
|
otel.exporter.prometheus.port = 9123
|
||||||
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://cassandra:7199/jmxrmi
|
otel.jmx.service.url = service:jmx:rmi:///jndi/rmi://cassandra:7199/jmxrmi
|
||||||
otel.jmx.groovy.script = /app/script.groovy
|
otel.jmx.groovy.script = /app/script.groovy
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ otel.jmx.target.system = cassandra
|
||||||
# these will be overridden by cmd line
|
# these will be overridden by cmd line
|
||||||
otel.jmx.username = wrong_username
|
otel.jmx.username = wrong_username
|
||||||
otel.jmx.password = wrong_password
|
otel.jmx.password = wrong_password
|
||||||
otel.otlp.endpoint = host.testcontainers.internal:80
|
otel.exporter.otlp.endpoint = host.testcontainers.internal:80
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,4 @@ otel.jmx.target.system = jvm
|
||||||
# these will be overridden by cmd line
|
# these will be overridden by cmd line
|
||||||
otel.jmx.username = wrong_username
|
otel.jmx.username = wrong_username
|
||||||
otel.jmx.password = wrong_password
|
otel.jmx.password = wrong_password
|
||||||
otel.otlp.endpoint = host.testcontainers.internal:80
|
otel.exporter.otlp.endpoint = host.testcontainers.internal:80
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'groovy'
|
apply plugin: 'groovy'
|
||||||
|
|
||||||
ext.releaseJavaVersion = JavaVersion.VERSION_1_7
|
ext.releaseJavaVersion = JavaVersion.VERSION_1_8
|
||||||
ext.testJavaVersion = JavaVersion.VERSION_1_8
|
ext.testJavaVersion = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ext {
|
ext {
|
||||||
versions = [
|
versions = [
|
||||||
otelStable : '0.8.0'
|
otelStable : '0.9.1'
|
||||||
]
|
]
|
||||||
|
|
||||||
libraries = [
|
libraries = [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue