diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h index 3d677c1a08..61828fd49e 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h @@ -22,7 +22,7 @@ struct OtlpGrpcMetricExporterOptions : public OtlpGrpcExporterOptions // Preferred Aggregation Temporality sdk::metrics::AggregationTemporality aggregation_temporality = - sdk::metrics::AggregationTemporality::kDelta; + sdk::metrics::AggregationTemporality::kCumulative; }; } // namespace otlp diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h index 7fbb000a34..140b5b886b 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h @@ -51,7 +51,7 @@ struct OtlpHttpMetricExporterOptions // Preferred Aggregation Temporality sdk::metrics::AggregationTemporality aggregation_temporality = - sdk::metrics::AggregationTemporality::kDelta; + sdk::metrics::AggregationTemporality::kCumulative; #ifdef ENABLE_ASYNC_EXPORT // Concurrent requests diff --git a/exporters/otlp/test/otlp_http_metric_exporter_test.cc b/exporters/otlp/test/otlp_http_metric_exporter_test.cc index 5dbb4cc2a7..54abb88511 100644 --- a/exporters/otlp/test/otlp_http_metric_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_metric_exporter_test.cc @@ -936,6 +936,28 @@ TEST_F(OtlpHttpMetricExporterTestPeer, DefaultEndpoint) EXPECT_EQ("http://localhost:4318/v1/metrics", GetOtlpDefaultMetricsEndpoint()); } +TEST_F(OtlpHttpMetricExporterTestPeer, CheckDefaultTemporality) +{ + std::unique_ptr exporter(new OtlpHttpMetricExporter()); + EXPECT_EQ( + opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality(opentelemetry::sdk::metrics::InstrumentType::kCounter)); + EXPECT_EQ( + opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality(opentelemetry::sdk::metrics::InstrumentType::kHistogram)); + EXPECT_EQ(opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType::kUpDownCounter)); + EXPECT_EQ(opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType::kObservableCounter)); + EXPECT_EQ(opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType::kObservableGauge)); + EXPECT_EQ(opentelemetry::sdk::metrics::AggregationTemporality::kCumulative, + exporter->GetAggregationTemporality( + opentelemetry::sdk::metrics::InstrumentType::kObservableUpDownCounter)); +} #endif } // namespace otlp