fix(telemetry): wire the metric export cadence constants to the reader

kMetricExportInterval and kMetricExportTimeout were declared but the reader
options set the same values as literals, so both constants were unused. constexpr
at namespace scope has internal linkage, so clang reports them under
-Wunused-const-variable, which -Dwerr=ON makes fatal: it failed the compile on
ubuntu-clang-release-amd64 and macos-arm64-release, and clang-tidy as well.

Using them removes two magic numbers and keeps the comment that explains why the
interval is 1 s.
This commit is contained in:
Pratik Mankawde
2026-09-03 18:44:04 +01:00
parent 54d6e80e2e
commit f5fff9b5f9

View File

@@ -543,11 +543,9 @@ public:
auto metricExporter = otlp_http::OtlpHttpMetricExporterFactory::Create(metricExporterOpts);
// Configure periodic metric reader (1-second export interval,
// matching the beast OTelCollector path).
metrics_sdk::PeriodicExportingMetricReaderOptions readerOpts;
readerOpts.export_interval_millis = std::chrono::milliseconds(1000);
readerOpts.export_timeout_millis = std::chrono::milliseconds(500);
readerOpts.export_interval_millis = kMetricExportInterval;
readerOpts.export_timeout_millis = kMetricExportTimeout;
auto reader = metrics_sdk::PeriodicExportingMetricReaderFactory::Create(
std::move(metricExporter), readerOpts);