Skip to content

Commit

Permalink
review default case for empty routing key
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiobastos committed Sep 12, 2023
1 parent 42fa8e8 commit 6fb23c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion exporter/loadbalancingexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 1 addition & 3 deletions exporter/loadbalancingexporter/metrics_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 6fb23c2

Please sign in to comment.