Skip to content

Commit

Permalink
misc(metrics)!: split global attributes into two (celestiaorg#2546)
Browse files Browse the repository at this point in the history
## Overview

Currently there is only one global attribute, that build by
concatenating both exported attributes:

```
"job" = "Bridge/robusta-11rc9/12D3KooWAEQUSJh7aJFq7Cw1mP4VWnqfHtHwwwnsXHFhpQ2DMn7j"
```

`Breaking`, because this PR is breaking metrics compatibility.
  • Loading branch information
walldiss authored and renaynay committed Aug 23, 2023
1 parent f4ff8a5 commit d64d7a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nodebuilder/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,13 @@ func initializeMetrics(
sdk.WithReader(sdk.NewPeriodicReader(exp, sdk.WithTimeout(2*time.Second))),
sdk.WithResource(resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceNamespaceKey.String(nodeType.String()),
semconv.ServiceNameKey.String(fmt.Sprintf("%s/%s", network.String(), peerID.String())))))
// ServiceNamespaceKey and ServiceNameKey will be concatenated into single attribute with key:
// "job" and value: "%service.namespace%/%service.name%"
semconv.ServiceNamespaceKey.String(network.String()),
semconv.ServiceNameKey.String(nodeType.String()),
// ServiceInstanceIDKey will be exported with key: "instance"
semconv.ServiceInstanceIDKey.String(peerID.String()),
)))
lc.Append(fx.Hook{
OnStop: func(ctx context.Context) error {
return provider.Shutdown(ctx)
Expand Down

0 comments on commit d64d7a8

Please sign in to comment.