Skip to content

Commit

Permalink
Make aggregationTemporality static in OtlpInMemoryMetricExporter
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrdom committed Feb 26, 2023
1 parent 95f6b1a commit 62850f2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ class OtlpInMemoryMetricExporter implements MetricExporter {

private final Queue<byte[]> collectedRequests = new ConcurrentLinkedQueue<>();

private final AggregationTemporality aggregationTemporality;
private final static AggregationTemporality aggregationTemporality = initAggregationTemporality();

OtlpInMemoryMetricExporter() {
private static AggregationTemporality initAggregationTemporality() {
// this configuration setting is for external users
// see https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7902
String temporalityProperty = System.getProperty("otel.javaagent.testing.exporter.temporality");
AggregationTemporality aggregationTemporality;
if (temporalityProperty == null) {
aggregationTemporality = AggregationTemporality.DELTA;
} else {
aggregationTemporality = AggregationTemporality.valueOf(temporalityProperty.toUpperCase());
}
logger.log(CONFIG, "Setting aggregation temporality to {0}", aggregationTemporality.toString());
return aggregationTemporality;
}

List<byte[]> getCollectedExportRequests() {
Expand Down

0 comments on commit 62850f2

Please sign in to comment.