opentelemetry-cpp icon indicating copy to clipboard operation
opentelemetry-cpp copied to clipboard

Preserving timestamps for prometheus exporter

Open nishkrishnan opened this issue 6 months ago • 3 comments

I see here that timestamps were explicitly removed from the prometheus exporter. However, shouldn't this be a setting for the user that allows them to choose whether timestamps should be honored or not?

In my case I want to preserve the timestamps that come from the source. How can I achieve that currently?

nishkrishnan avatar Jun 17 '25 14:06 nishkrishnan

The time setting is now restored in the latest version and is derived from the metrics data. Exporters should only handle I/O; if you need to modify metrics data, please implement a custom processor.

owent avatar Jun 24 '25 09:06 owent

You can see the original issue here: https://github.com/open-telemetry/opentelemetry-cpp/issues/2316. Unless you are re-exposing metrics from another source with significantly different timestamps, you should not add them. I'm not opposed to having an option to enable explicit timestamps, but we should make sure we define it in the spec here so that languages use similar names for the option.

dashpole avatar Jul 01 '25 13:07 dashpole

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Oct 25 '25 02:10 github-actions[bot]