Skip to content

Commit

Permalink
Add constant for unknown_service
Browse files Browse the repository at this point in the history
  • Loading branch information
bryn committed Sep 26, 2023
1 parent fba92d2 commit 40acb7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apollo-router/src/plugins/telemetry/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub(crate) mod apollo;
pub(crate) mod otlp;
pub(crate) mod prometheus;
pub(crate) mod span_metrics_exporter;
static UNKNOWN_SERVICE: &str = "unknown_service";

#[derive(Debug, Clone, Deserialize, JsonSchema)]
#[serde(deny_unknown_fields)]
Expand Down Expand Up @@ -543,7 +544,7 @@ impl MetricsBuilder {
// Otel resources can be initialized from env variables, there is an override mechanism, but it's broken for service name as it will always override service.name
// If the service name is set to unknown service then override it from the config
if resource.get(opentelemetry_semantic_conventions::resource::SERVICE_NAME)
== Some("unknown_service".into())
== Some(UNKNOWN_SERVICE.into())
{
if let Some(service_name) = Resource::from_detectors(
Duration::from_secs(0),
Expand Down

0 comments on commit 40acb7b

Please sign in to comment.