{"record":{"id":"67b9421e174d9a93","repo":"juspay/hyperswitch","slug":"failed-to-build-metrics-exporter","errorCode":null,"errorMessage":"Failed to build metrics exporter","messagePattern":"Failed to build metrics exporter","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/router_env/src/logger/setup.rs","lineNumber":373,"sourceCode":"fn setup_metrics_pipeline(config: &config::LogTelemetry) {\n    use opentelemetry_otlp::WithExportConfig;\n\n    let exporter_result = opentelemetry_otlp::MetricExporter::builder()\n        .with_tonic()\n        .with_temporality(opentelemetry_sdk::metrics::Temporality::Cumulative)\n        .with_export_config(get_opentelemetry_exporter_config(config))\n        .build();\n\n    let exporter = if config.ignore_errors {\n        #[allow(clippy::print_stderr)] // The logger hasn't been initialized yet\n        exporter_result\n            .inspect_err(|error| eprintln!(\"Failed to build metrics exporter: {error:?}\"))\n            .ok();\n        return;\n    } else {\n        // Safety: This is conditional, there is an option to avoid this behavior at runtime.\n        #[allow(clippy::expect_used)]\n        exporter_result.expect(\"Failed to build metrics exporter\")\n    };\n\n    let reader = opentelemetry_sdk::metrics::PeriodicReader::builder(\n        exporter,\n        // The runtime would have to be updated if a different web framework is used\n        opentelemetry_sdk::runtime::TokioCurrentThread,\n    )\n    .with_interval(Duration::from_secs(3))\n    .with_timeout(Duration::from_secs(10))\n    .build();\n\n    let provider = opentelemetry_sdk::metrics::SdkMeterProvider::builder()\n        .with_reader(reader)\n        .with_resource(opentelemetry_sdk::Resource::new([\n            opentelemetry::KeyValue::new(\n                \"pod\",\n                std::env::var(\"POD_NAME\").unwrap_or(String::from(\"hyperswitch-server-default\")),\n            ),","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/juspay/hyperswitch/blob/705a3219504c3cf9034e71d956455f8834ea4e64/crates/router_env/src/logger/setup.rs#L355-L391","documentation":"Error \"Failed to build metrics exporter\" thrown in juspay/hyperswitch.","triggerScenarios":"Thrown at crates/router_env/src/logger/setup.rs:373 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the OTLP metrics endpoint/configuration and that the collector is reachable"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"705a3219504c3cf9034e71d956455f8834ea4e64","analyzedAt":"2026-08-19T10:36:43.745Z","contentChangedAt":"2026-08-19T10:36:43.745Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}