Skip to content

Commit

Permalink
Change default temporality as "Cumulative" for OTLP metrics exporters (
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Dec 1, 2022
1 parent a24488f commit 2accc77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,28 @@ TEST_F(OtlpHttpMetricExporterTestPeer, DefaultEndpoint)
EXPECT_EQ("http://localhost:4318/v1/metrics", GetOtlpDefaultMetricsEndpoint());
}

TEST_F(OtlpHttpMetricExporterTestPeer, CheckDefaultTemporality)
{
std::unique_ptr<OtlpHttpMetricExporter> 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
Expand Down

0 comments on commit 2accc77

Please sign in to comment.