Skip to content

Commit

Permalink
test changes for PA
Browse files Browse the repository at this point in the history
Signed-off-by: Gagan Juneja <[email protected]>
  • Loading branch information
Gagan Juneja committed May 7, 2024
1 parent d5130bb commit f7c2610
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;

import io.opentelemetry.exporter.logging.LoggingMetricExporter;
import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter;
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector;
import io.opentelemetry.sdk.metrics.export.MetricExporter;

/**
Expand All @@ -46,7 +50,16 @@ private OTelMetricsExporterFactory() {
*/
public static MetricExporter create(Settings settings) {
Class<MetricExporter> MetricExporterProviderClass = OTelTelemetrySettings.OTEL_METRICS_EXPORTER_CLASS_SETTING.get(settings);
MetricExporter metricExporter = instantiateExporter(MetricExporterProviderClass);
MetricExporter metricExporter;
if (MetricExporterProviderClass.getName().equals(LoggingMetricExporter.class.getName())) {
metricExporter = LoggingMetricExporter.create(AggregationTemporality.DELTA);
} else if (MetricExporterProviderClass.getName().equals(OtlpGrpcMetricExporter.class.getName())) {
metricExporter = OtlpGrpcMetricExporter.builder()
.setAggregationTemporalitySelector(AggregationTemporalitySelector.deltaPreferred())
.build();
} else {
metricExporter = instantiateExporter(MetricExporterProviderClass);
}
logger.info("Successfully instantiated the Metrics MetricExporter class {}", MetricExporterProviderClass);
return metricExporter;
}
Expand Down

0 comments on commit f7c2610

Please sign in to comment.