Per open-telemetry/opentelemetry-specification#2983 and its fix, open-telemetry/opentelemetry-specification#5305, the metrics spec would require the periodic exporting MetricReader to collect and export whatever metrics were recorded since the last periodic tick before the underlying exporter is shut down.
I'm not experienced in opentelemetry-cpp or its codebase, but the following AI-assisted analysis seems to confirm PeriodicExportingMetricReader::Shutdown doesn't currently do this:
Metrics recorded since the last periodic tick appear to be silently dropped on shutdown. I'd like to know if it's possible for Shutdown() to perform one last collect-and-export cycle (the same effect as ForceFlush() or just calling ForceFlush()) before the exporter is shut down.
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Per open-telemetry/opentelemetry-specification#2983 and its fix, open-telemetry/opentelemetry-specification#5305, the metrics spec would require the periodic exporting MetricReader to collect and export whatever metrics were recorded since the last periodic tick before the underlying exporter is shut down.
I'm not experienced in
opentelemetry-cppor its codebase, but the following AI-assisted analysis seems to confirmPeriodicExportingMetricReader::Shutdowndoesn't currently do this:MetricReader::Shutdownsets the shutdown flag before callingOnShutDown.OnShutDownjust wakes the worker thread, joins it, and shuts the exporter down — no extra collect.CollectAndExportOnce), since the shutdown flag is checked after waking up, not before.OnForceFlush's wait condition returns immediately onceIsShutdown()is true, without the worker having collected anything — so callingForceFlush()manually doesn't help either onceShutdown()has started (calling it beforeShutdown()does work today, for what it's worth).Metrics recorded since the last periodic tick appear to be silently dropped on shutdown. I'd like to know if it's possible for
Shutdown()to perform one last collect-and-export cycle (the same effect asForceFlush()or just callingForceFlush()) before the exporter is shut down.Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.