Skip to content

Commit 855f86d

Browse files
committed
Add error log for gauge delta temporality.
1 parent 60df532 commit 855f86d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sdk/src/metrics/state/metric_collector.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ MetricCollector::MetricCollector(opentelemetry::sdk::metrics::MeterContext *cont
3535
AggregationTemporality MetricCollector::GetAggregationTemporality(
3636
InstrumentType instrument_type) noexcept
3737
{
38-
return metric_reader_->GetAggregationTemporality(instrument_type);
38+
auto aggregation_temporality = metric_reader_->GetAggregationTemporality(instrument_type);
39+
if(aggregation_temporality == AggregationTemporality::kDelta && instrument_type == InstrumentType::kGauge) {
40+
OTEL_INTERNAL_LOG_ERROR("[MetricCollector::GetAggregationTemporality] - Error getting aggregation temporality."
41+
<< "Delta temporality for Synchronous Gauge is currently not supported, using cumulative temporality");
42+
43+
return AggregationTemporality::kCumulative;
44+
}
45+
return aggregation_temporality;
3946
}
4047

4148
bool MetricCollector::Collect(

0 commit comments

Comments
 (0)