Add missing fields to OTLP metric exporters (#6402)
This commit is contained in:
parent
1960606bce
commit
a5fc312d26
|
@ -1,2 +1,7 @@
|
||||||
Comparing source compatibility of against
|
Comparing source compatibility of against
|
||||||
No changes.
|
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector (not serializable)
|
||||||
|
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||||
|
+++ NEW METHOD: PUBLIC(+) STATIC(+) java.lang.String asString(io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector)
|
||||||
|
*** MODIFIED INTERFACE: PUBLIC ABSTRACT io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector (not serializable)
|
||||||
|
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
|
||||||
|
+++ NEW METHOD: PUBLIC(+) STATIC(+) java.lang.String asString(io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector)
|
||||||
|
|
|
@ -18,6 +18,7 @@ import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.StringJoiner;
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,6 +125,15 @@ public final class OtlpHttpMetricExporter implements MetricExporter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OtlpHttpMetricExporter{" + builder.toString(false) + "}";
|
StringJoiner joiner = new StringJoiner(", ", "OtlpHttpMetricExporter{", "}");
|
||||||
|
joiner.add(builder.toString(false));
|
||||||
|
joiner.add(
|
||||||
|
"aggregationTemporalitySelector="
|
||||||
|
+ AggregationTemporalitySelector.asString(aggregationTemporalitySelector));
|
||||||
|
joiner.add(
|
||||||
|
"defaultAggregationSelector="
|
||||||
|
+ DefaultAggregationSelector.asString(defaultAggregationSelector));
|
||||||
|
joiner.add("memoryMode=" + memoryMode);
|
||||||
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.StringJoiner;
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,6 +129,15 @@ public final class OtlpGrpcMetricExporter implements MetricExporter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OtlpGrpcMetricExporter{" + builder.toString(false) + "}";
|
StringJoiner joiner = new StringJoiner(", ", "OtlpGrpcMetricExporter{", "}");
|
||||||
|
joiner.add(builder.toString(false));
|
||||||
|
joiner.add(
|
||||||
|
"aggregationTemporalitySelector="
|
||||||
|
+ AggregationTemporalitySelector.asString(aggregationTemporalitySelector));
|
||||||
|
joiner.add(
|
||||||
|
"defaultAggregationSelector="
|
||||||
|
+ DefaultAggregationSelector.asString(defaultAggregationSelector));
|
||||||
|
joiner.add("memoryMode=" + memoryMode);
|
||||||
|
return joiner.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,9 @@ import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
||||||
import io.opentelemetry.sdk.metrics.data.MetricData;
|
import io.opentelemetry.sdk.metrics.data.MetricData;
|
||||||
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class OtlpHttpMetricExporterOkHttpSenderTest
|
class OtlpHttpMetricExporterOkHttpSenderTest
|
||||||
|
@ -77,6 +79,33 @@ class OtlpHttpMetricExporterOkHttpSenderTest
|
||||||
.hasMessage("defaultAggregationSelector");
|
.hasMessage("defaultAggregationSelector");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Test configuration specific to metric exporter. */
|
||||||
|
@Test
|
||||||
|
void stringRepresentation() {
|
||||||
|
try (MetricExporter metricExporter = OtlpHttpMetricExporter.builder().build()) {
|
||||||
|
assertThat(metricExporter.toString())
|
||||||
|
.matches(
|
||||||
|
"OtlpHttpMetricExporter\\{"
|
||||||
|
+ "exporterName=otlp, "
|
||||||
|
+ "type=metric, "
|
||||||
|
+ "endpoint=http://localhost:4318/v1/metrics, "
|
||||||
|
+ "timeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "proxyOptions=null, "
|
||||||
|
+ "compressorEncoding=null, "
|
||||||
|
+ "connectTimeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "exportAsJson=false, "
|
||||||
|
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}, "
|
||||||
|
+ "aggregationTemporalitySelector=AggregationTemporalitySelector\\{.*\\}, "
|
||||||
|
+ "defaultAggregationSelector=DefaultAggregationSelector\\{.*\\}, "
|
||||||
|
+ "memoryMode=IMMUTABLE_DATA"
|
||||||
|
+ "\\}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TelemetryExporterBuilder<MetricData> exporterBuilder() {
|
protected TelemetryExporterBuilder<MetricData> exporterBuilder() {
|
||||||
return new HttpMetricExporterBuilderWrapper(OtlpHttpMetricExporter.builder());
|
return new HttpMetricExporterBuilderWrapper(OtlpHttpMetricExporter.builder());
|
||||||
|
|
|
@ -23,8 +23,10 @@ import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
||||||
import io.opentelemetry.sdk.metrics.data.MetricData;
|
import io.opentelemetry.sdk.metrics.data.MetricData;
|
||||||
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class OtlpGrpcMetricExporterTest
|
class OtlpGrpcMetricExporterTest
|
||||||
|
@ -78,6 +80,32 @@ class OtlpGrpcMetricExporterTest
|
||||||
.hasMessage("defaultAggregationSelector");
|
.hasMessage("defaultAggregationSelector");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Test configuration specific to metric exporter. */
|
||||||
|
@Test
|
||||||
|
void stringRepresentation() {
|
||||||
|
try (MetricExporter metricExporter = OtlpGrpcMetricExporter.builder().build()) {
|
||||||
|
assertThat(metricExporter.toString())
|
||||||
|
.matches(
|
||||||
|
"OtlpGrpcMetricExporter\\{"
|
||||||
|
+ "exporterName=otlp, "
|
||||||
|
+ "type=metric, "
|
||||||
|
+ "endpoint=http://localhost:4317, "
|
||||||
|
+ "endpointPath=.*, "
|
||||||
|
+ "timeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "connectTimeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "compressorEncoding=null, "
|
||||||
|
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}, "
|
||||||
|
+ "aggregationTemporalitySelector=AggregationTemporalitySelector\\{.*\\}, "
|
||||||
|
+ "defaultAggregationSelector=DefaultAggregationSelector\\{.*\\}, "
|
||||||
|
+ "memoryMode=IMMUTABLE_DATA"
|
||||||
|
+ "\\}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void usingOkHttp() throws Exception {
|
void usingOkHttp() throws Exception {
|
||||||
try (Closeable exporter = OtlpGrpcMetricExporter.builder().build()) {
|
try (Closeable exporter = OtlpGrpcMetricExporter.builder().build()) {
|
||||||
|
|
|
@ -24,7 +24,9 @@ import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
||||||
import io.opentelemetry.sdk.metrics.data.MetricData;
|
import io.opentelemetry.sdk.metrics.data.MetricData;
|
||||||
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class OtlpHttpMetricExporterJdkSenderTest
|
class OtlpHttpMetricExporterJdkSenderTest
|
||||||
|
@ -78,6 +80,33 @@ class OtlpHttpMetricExporterJdkSenderTest
|
||||||
.hasMessage("defaultAggregationSelector");
|
.hasMessage("defaultAggregationSelector");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Test configuration specific to metric exporter. */
|
||||||
|
@Test
|
||||||
|
void stringRepresentation() {
|
||||||
|
try (MetricExporter metricExporter = OtlpHttpMetricExporter.builder().build()) {
|
||||||
|
assertThat(metricExporter.toString())
|
||||||
|
.matches(
|
||||||
|
"OtlpHttpMetricExporter\\{"
|
||||||
|
+ "exporterName=otlp, "
|
||||||
|
+ "type=metric, "
|
||||||
|
+ "endpoint=http://localhost:4318/v1/metrics, "
|
||||||
|
+ "timeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "proxyOptions=null, "
|
||||||
|
+ "compressorEncoding=null, "
|
||||||
|
+ "connectTimeoutNanos="
|
||||||
|
+ TimeUnit.SECONDS.toNanos(10)
|
||||||
|
+ ", "
|
||||||
|
+ "exportAsJson=false, "
|
||||||
|
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}, "
|
||||||
|
+ "aggregationTemporalitySelector=AggregationTemporalitySelector\\{.*\\}, "
|
||||||
|
+ "defaultAggregationSelector=DefaultAggregationSelector\\{.*\\}, "
|
||||||
|
+ "memoryMode=IMMUTABLE_DATA"
|
||||||
|
+ "\\}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasAuthenticatorSupport() {
|
protected boolean hasAuthenticatorSupport() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -872,7 +872,7 @@ public abstract class AbstractGrpcTelemetryExporterTest<T, U extends Message> {
|
||||||
+ ", "
|
+ ", "
|
||||||
+ "compressorEncoding=null, "
|
+ "compressorEncoding=null, "
|
||||||
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}"
|
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}"
|
||||||
+ ".*" // Maybe additional grpcChannel field
|
+ ".*" // Maybe additional grpcChannel field, signal specific fields
|
||||||
+ "\\}");
|
+ "\\}");
|
||||||
} finally {
|
} finally {
|
||||||
telemetryExporter.shutdown();
|
telemetryExporter.shutdown();
|
||||||
|
@ -914,7 +914,7 @@ public abstract class AbstractGrpcTelemetryExporterTest<T, U extends Message> {
|
||||||
+ "compressorEncoding=gzip, "
|
+ "compressorEncoding=gzip, "
|
||||||
+ "headers=Headers\\{.*foo=OBFUSCATED.*\\}, "
|
+ "headers=Headers\\{.*foo=OBFUSCATED.*\\}, "
|
||||||
+ "retryPolicy=RetryPolicy\\{maxAttempts=2, initialBackoff=PT0\\.05S, maxBackoff=PT3S, backoffMultiplier=1\\.3\\}"
|
+ "retryPolicy=RetryPolicy\\{maxAttempts=2, initialBackoff=PT0\\.05S, maxBackoff=PT3S, backoffMultiplier=1\\.3\\}"
|
||||||
+ ".*" // Maybe additional grpcChannel field
|
+ ".*" // Maybe additional grpcChannel field, signal specific fields
|
||||||
+ "\\}");
|
+ "\\}");
|
||||||
} finally {
|
} finally {
|
||||||
telemetryExporter.shutdown();
|
telemetryExporter.shutdown();
|
||||||
|
|
|
@ -858,6 +858,7 @@ public abstract class AbstractHttpTelemetryExporterTest<T, U extends Message> {
|
||||||
+ ", "
|
+ ", "
|
||||||
+ "exportAsJson=false, "
|
+ "exportAsJson=false, "
|
||||||
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}"
|
+ "headers=Headers\\{User-Agent=OBFUSCATED\\}"
|
||||||
|
+ ".*" // Maybe additional signal specific fields
|
||||||
+ "\\}");
|
+ "\\}");
|
||||||
} finally {
|
} finally {
|
||||||
telemetryExporter.shutdown();
|
telemetryExporter.shutdown();
|
||||||
|
@ -900,6 +901,7 @@ public abstract class AbstractHttpTelemetryExporterTest<T, U extends Message> {
|
||||||
+ "exportAsJson=false, "
|
+ "exportAsJson=false, "
|
||||||
+ "headers=Headers\\{.*foo=OBFUSCATED.*\\}, "
|
+ "headers=Headers\\{.*foo=OBFUSCATED.*\\}, "
|
||||||
+ "retryPolicy=RetryPolicy\\{maxAttempts=2, initialBackoff=PT0\\.05S, maxBackoff=PT3S, backoffMultiplier=1\\.3\\}"
|
+ "retryPolicy=RetryPolicy\\{maxAttempts=2, initialBackoff=PT0\\.05S, maxBackoff=PT3S, backoffMultiplier=1\\.3\\}"
|
||||||
|
+ ".*" // Maybe additional signal specific fields
|
||||||
+ "\\}");
|
+ "\\}");
|
||||||
} finally {
|
} finally {
|
||||||
telemetryExporter.shutdown();
|
telemetryExporter.shutdown();
|
||||||
|
|
|
@ -28,6 +28,10 @@ import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Header
|
||||||
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric;
|
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric;
|
||||||
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric.DefaultHistogramAggregation;
|
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric.DefaultHistogramAggregation;
|
||||||
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus;
|
import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus;
|
||||||
|
import io.opentelemetry.sdk.metrics.Aggregation;
|
||||||
|
import io.opentelemetry.sdk.metrics.InstrumentType;
|
||||||
|
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
|
||||||
|
import io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector;
|
||||||
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
import io.opentelemetry.sdk.metrics.export.MetricExporter;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -118,6 +122,10 @@ class MetricExporterFactoryTest {
|
||||||
.addHeader("key2", "value2")
|
.addHeader("key2", "value2")
|
||||||
.setTimeout(Duration.ofSeconds(15))
|
.setTimeout(Duration.ofSeconds(15))
|
||||||
.setCompression("gzip")
|
.setCompression("gzip")
|
||||||
|
.setAggregationTemporalitySelector(AggregationTemporalitySelector.deltaPreferred())
|
||||||
|
.setDefaultAggregationSelector(
|
||||||
|
DefaultAggregationSelector.getDefault()
|
||||||
|
.with(InstrumentType.HISTOGRAM, Aggregation.base2ExponentialBucketHistogram()))
|
||||||
.build();
|
.build();
|
||||||
cleanup.addCloseable(expectedExporter);
|
cleanup.addCloseable(expectedExporter);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.sdk.metrics.export;
|
||||||
|
|
||||||
import io.opentelemetry.sdk.metrics.InstrumentType;
|
import io.opentelemetry.sdk.metrics.InstrumentType;
|
||||||
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A functional interface that selects {@link AggregationTemporality} based on {@link
|
* A functional interface that selects {@link AggregationTemporality} based on {@link
|
||||||
|
@ -76,4 +77,16 @@ public interface AggregationTemporalitySelector {
|
||||||
|
|
||||||
/** Return the aggregation temporality for the {@link InstrumentType}. */
|
/** Return the aggregation temporality for the {@link InstrumentType}. */
|
||||||
AggregationTemporality getAggregationTemporality(InstrumentType instrumentType);
|
AggregationTemporality getAggregationTemporality(InstrumentType instrumentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this selector, for using in {@link Object#toString()}
|
||||||
|
* implementations.
|
||||||
|
*/
|
||||||
|
static String asString(AggregationTemporalitySelector selector) {
|
||||||
|
StringJoiner joiner = new StringJoiner(", ", "AggregationTemporalitySelector{", "}");
|
||||||
|
for (InstrumentType type : InstrumentType.values()) {
|
||||||
|
joiner.add(type.name() + "=" + selector.getAggregationTemporality(type).name());
|
||||||
|
}
|
||||||
|
return joiner.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import static java.util.Objects.requireNonNull;
|
||||||
|
|
||||||
import io.opentelemetry.sdk.metrics.Aggregation;
|
import io.opentelemetry.sdk.metrics.Aggregation;
|
||||||
import io.opentelemetry.sdk.metrics.InstrumentType;
|
import io.opentelemetry.sdk.metrics.InstrumentType;
|
||||||
|
import io.opentelemetry.sdk.metrics.internal.aggregator.AggregationUtil;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A functional interface that selects default {@link Aggregation} based on {@link InstrumentType}.
|
* A functional interface that selects default {@link Aggregation} based on {@link InstrumentType}.
|
||||||
|
@ -58,4 +60,19 @@ public interface DefaultAggregationSelector {
|
||||||
* <p>The default aggregation is used when an instrument does not match any views.
|
* <p>The default aggregation is used when an instrument does not match any views.
|
||||||
*/
|
*/
|
||||||
Aggregation getDefaultAggregation(InstrumentType instrumentType);
|
Aggregation getDefaultAggregation(InstrumentType instrumentType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this selector, for using in {@link Object#toString()}
|
||||||
|
* implementations.
|
||||||
|
*/
|
||||||
|
static String asString(DefaultAggregationSelector selector) {
|
||||||
|
StringJoiner joiner = new StringJoiner(", ", "DefaultAggregationSelector{", "}");
|
||||||
|
for (InstrumentType type : InstrumentType.values()) {
|
||||||
|
joiner.add(
|
||||||
|
type.name()
|
||||||
|
+ "="
|
||||||
|
+ AggregationUtil.aggregationName(selector.getDefaultAggregation(type)));
|
||||||
|
}
|
||||||
|
return joiner.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,4 +63,32 @@ class AggregationTemporalitySelectorTest {
|
||||||
assertThat(selector.getAggregationTemporality(InstrumentType.OBSERVABLE_UP_DOWN_COUNTER))
|
assertThat(selector.getAggregationTemporality(InstrumentType.OBSERVABLE_UP_DOWN_COUNTER))
|
||||||
.isEqualTo(AggregationTemporality.CUMULATIVE);
|
.isEqualTo(AggregationTemporality.CUMULATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void stringRepresentation() {
|
||||||
|
assertThat(
|
||||||
|
AggregationTemporalitySelector.asString(
|
||||||
|
AggregationTemporalitySelector.alwaysCumulative()))
|
||||||
|
.isEqualTo(
|
||||||
|
"AggregationTemporalitySelector{"
|
||||||
|
+ "COUNTER=CUMULATIVE, "
|
||||||
|
+ "UP_DOWN_COUNTER=CUMULATIVE, "
|
||||||
|
+ "HISTOGRAM=CUMULATIVE, "
|
||||||
|
+ "OBSERVABLE_COUNTER=CUMULATIVE, "
|
||||||
|
+ "OBSERVABLE_UP_DOWN_COUNTER=CUMULATIVE, "
|
||||||
|
+ "OBSERVABLE_GAUGE=CUMULATIVE"
|
||||||
|
+ "}");
|
||||||
|
assertThat(
|
||||||
|
AggregationTemporalitySelector.asString(
|
||||||
|
AggregationTemporalitySelector.deltaPreferred()))
|
||||||
|
.isEqualTo(
|
||||||
|
"AggregationTemporalitySelector{"
|
||||||
|
+ "COUNTER=DELTA, "
|
||||||
|
+ "UP_DOWN_COUNTER=CUMULATIVE, "
|
||||||
|
+ "HISTOGRAM=DELTA, "
|
||||||
|
+ "OBSERVABLE_COUNTER=DELTA, "
|
||||||
|
+ "OBSERVABLE_UP_DOWN_COUNTER=CUMULATIVE, "
|
||||||
|
+ "OBSERVABLE_GAUGE=DELTA"
|
||||||
|
+ "}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,4 +61,31 @@ class DefaultAggregationSelectorTest {
|
||||||
assertThat(selector2.getDefaultAggregation(InstrumentType.OBSERVABLE_GAUGE))
|
assertThat(selector2.getDefaultAggregation(InstrumentType.OBSERVABLE_GAUGE))
|
||||||
.isEqualTo(Aggregation.defaultAggregation());
|
.isEqualTo(Aggregation.defaultAggregation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void stringRepresentation() {
|
||||||
|
assertThat(DefaultAggregationSelector.asString(DefaultAggregationSelector.getDefault()))
|
||||||
|
.isEqualTo(
|
||||||
|
"DefaultAggregationSelector{"
|
||||||
|
+ "COUNTER=default, "
|
||||||
|
+ "UP_DOWN_COUNTER=default, "
|
||||||
|
+ "HISTOGRAM=default, "
|
||||||
|
+ "OBSERVABLE_COUNTER=default, "
|
||||||
|
+ "OBSERVABLE_UP_DOWN_COUNTER=default, "
|
||||||
|
+ "OBSERVABLE_GAUGE=default"
|
||||||
|
+ "}");
|
||||||
|
assertThat(
|
||||||
|
DefaultAggregationSelector.asString(
|
||||||
|
DefaultAggregationSelector.getDefault()
|
||||||
|
.with(InstrumentType.HISTOGRAM, Aggregation.base2ExponentialBucketHistogram())))
|
||||||
|
.isEqualTo(
|
||||||
|
"DefaultAggregationSelector{"
|
||||||
|
+ "COUNTER=default, "
|
||||||
|
+ "UP_DOWN_COUNTER=default, "
|
||||||
|
+ "HISTOGRAM=base2_exponential_bucket_histogram, "
|
||||||
|
+ "OBSERVABLE_COUNTER=default, "
|
||||||
|
+ "OBSERVABLE_UP_DOWN_COUNTER=default, "
|
||||||
|
+ "OBSERVABLE_GAUGE=default"
|
||||||
|
+ "}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue