Skip to content

Commit fe704f3

Browse files
authored
Switch UpDownCounters to cumulative aggregation temporality (#347)
1 parent fe4e8c6 commit fe704f3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

logfire/_internal/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@
8888

8989
METRICS_PREFERRED_TEMPORALITY = {
9090
Counter: AggregationTemporality.DELTA,
91-
UpDownCounter: AggregationTemporality.DELTA,
91+
UpDownCounter: AggregationTemporality.CUMULATIVE,
9292
Histogram: AggregationTemporality.DELTA,
9393
ObservableCounter: AggregationTemporality.DELTA,
94-
ObservableUpDownCounter: AggregationTemporality.DELTA,
95-
ObservableGauge: AggregationTemporality.DELTA,
94+
ObservableUpDownCounter: AggregationTemporality.CUMULATIVE,
95+
ObservableGauge: AggregationTemporality.CUMULATIVE,
9696
}
9797
"""This should be passed as the `preferred_temporality` argument of metric readers and exporters."""
9898

tests/otel_integrations/test_django.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_good_route(client: Client, exporter: TestExporter, metrics_reader: InMe
4646
'value': 0,
4747
}
4848
],
49-
'aggregation_temporality': 1,
49+
'aggregation_temporality': 2,
5050
'is_monotonic': False,
5151
},
5252
},

tests/test_metrics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ def test_create_metric_up_down_counter(metrics_reader: InMemoryMetricReader) ->
211211
'attributes': {},
212212
'start_time_unix_nano': IsInt(),
213213
'time_unix_nano': IsInt(),
214-
'value': 4300,
214+
'value': 4321,
215215
}
216216
],
217-
'aggregation_temporality': AggregationTemporality.DELTA,
217+
'aggregation_temporality': AggregationTemporality.CUMULATIVE,
218218
'is_monotonic': False,
219219
},
220220
}
@@ -313,10 +313,10 @@ def observable_counter(options: CallbackOptions):
313313
'attributes': {},
314314
'start_time_unix_nano': IsInt(),
315315
'time_unix_nano': IsInt(),
316-
'value': 4300,
316+
'value': 4321,
317317
}
318318
],
319-
'aggregation_temporality': AggregationTemporality.DELTA,
319+
'aggregation_temporality': AggregationTemporality.CUMULATIVE,
320320
'is_monotonic': False,
321321
},
322322
}

0 commit comments

Comments
 (0)