From 6fb23c2b5a007b432b5652820bdd4f2612ebcb7d Mon Sep 17 00:00:00 2001 From: Claudio B Date: Tue, 12 Sep 2023 11:44:16 -0300 Subject: [PATCH] review default case for empty routing key --- exporter/loadbalancingexporter/README.md | 4 +++- exporter/loadbalancingexporter/metrics_exporter.go | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exporter/loadbalancingexporter/README.md b/exporter/loadbalancingexporter/README.md index 879c555dc137..8eacdc4ab481 100644 --- a/exporter/loadbalancingexporter/README.md +++ b/exporter/loadbalancingexporter/README.md @@ -31,7 +31,9 @@ The options for `routing_key` are: `service`, `traceID`, `metric`, `resource`. **Important**: Don't use traceID in metric pipeline. -If no `routing_key` is configured, the default routing mechanism is `traceID` . This means that spans belonging to the same `traceID` (or `service.name`, when `service` is used as the `routing_key`) will be sent to the same backend. +If no `routing_key` is configured, the default routing mechanism is `traceID` for traces, while `service` is the default for metrics. This means that spans belonging to the same `traceID` (or `service.name`, when `service` is used as the `routing_key`) will be sent to the same backend. + +If no routing_key is configured, the default routing mechanism is traceID for traces, while service is the default for metrics It requires a source of backend information to be provided: static, with a fixed list of backends, or DNS, with a hostname that will resolve to all IP addresses to use. The DNS resolver will periodically check for updates. diff --git a/exporter/loadbalancingexporter/metrics_exporter.go b/exporter/loadbalancingexporter/metrics_exporter.go index e9bb905eed31..0592ee468213 100644 --- a/exporter/loadbalancingexporter/metrics_exporter.go +++ b/exporter/loadbalancingexporter/metrics_exporter.go @@ -49,15 +49,13 @@ func newMetricsExporter(params exporter.CreateSettings, cfg component.Config) (* metricExporter := metricExporterImp{loadBalancer: lb, routingKey: svcRouting} switch cfg.(*Config).RoutingKey { - case "service": // , "" + case "service", "": // default case for empty routing key metricExporter.routingKey = svcRouting case "resource": metricExporter.routingKey = resourceRouting case "metric": metricExporter.routingKey = metricNameRouting - case "traceID", "": - fallthrough default: return nil, fmt.Errorf("unsupported routing_key: '%s'", cfg.(*Config).RoutingKey) }