Skip to content

fix: use delta base aggregation to fit current export behaviour#42

Closed
JeremyAube wants to merge 2 commits into
electric-sql:mainfrom
mirego:main
Closed

fix: use delta base aggregation to fit current export behaviour#42
JeremyAube wants to merge 2 commits into
electric-sql:mainfrom
mirego:main

Conversation

@JeremyAube

Copy link
Copy Markdown

The current metric store implementation clear all the metrics after sending it to the OTLP endpoint at
lib/otel_metric_exporter/metric_store.ex:226.

This implementation fits the Delta Temporal Aggregation method of sending metrics where we send the delta between the last export as compared to the currently configured Cumulative Temporal Aggregation where we would instead send the accumulation of all metrics since the start of the application on every export. More information can be found in the OTEL docs here:
https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality

This doesn't cause an issue with Prometheus since it uses start_time_unix_nano from the exported metric to trigger reset detection. Since we update this start time on every new export, this essentially means that reset detection is triggered for every new "cummulative" metric export. Prometheus seems to handle gracefully even though it can lead to some innacuracies from what I heard. On the other hand, providers like New Relic doesn't seem to handle this as gracefully and makes the metric unusable for reasons unknown to me at this moment.

The change the Delta Temporal Aggregation does fix the issue for New Relic, on top of reducing unnecessary work for Premetheus.

The current metric store implementation clear all the metrics after
sending it to the OTLP endpoint at
lib/otel_metric_exporter/metric_store.ex:226.

This implementation fits the Delta Temporal Aggregation method of
sending metrics where we send the delta between the last export as
compared to the currently configured Cumulative Temporal Aggregation
where we would instead send the accumulation of all metrics since the
start of the application on every export. More information can be found
in the OTEL docs here:
https://opentelemetry.io/docs/specs/otel/metrics/data-model/#temporality

This doesn't cause an issue with Prometheus since it uses
`start_time_unix_nano` from the exported metric to trigger reset
detection. Since we update this start time on every new export, this
essentially means that reset detection is triggered for every new
"cummulative" metric export. Prometheus seems to handle gracefully even
though it can lead to some innacuracies from what I heard. On the other
hand, providers like New Relic doesn't seem to handle this as gracefully
and makes the metric unusable for reasons unknown to me at this moment.

The change the Delta Temporal Aggregation does fix the issue for New
Relic, on top of reducing unnecessary work for Premetheus.
@JeremyAube JeremyAube changed the title fix: use delta base aggregation to fit current model fix: use delta base aggregation to fit current export behaviour May 27, 2026
@JeremyAube

Copy link
Copy Markdown
Author

Actually, I just noticed that it does seem to cause an issue with Prometheus. I will investigate this further.

@JeremyAube JeremyAube closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant