Skip to content

Commit 582a8ba

Browse files
authored
servicename (#276)
1 parent c421555 commit 582a8ba

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cmd/gcp/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func main() {
7070
flag.Parse()
7171
ctx := context.Background()
7272

73-
shutdownOTel := initOTel(ctx, *traceFraction)
73+
shutdownOTel := initOTel(ctx, *traceFraction, *origin)
7474
defer shutdownOTel(ctx)
7575

7676
signer, err := NewSecretManagerSigner(ctx, *signerPublicKeySecretName, *signerPrivateKeySecretName)

cmd/gcp/otel.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
//
3535
// Tracing is enabled with statistical sampling, with the probability passed in.
3636
// Returns a shutdown function which should be called just before exiting the process.
37-
func initOTel(ctx context.Context, traceFraction float64) func(context.Context) {
37+
func initOTel(ctx context.Context, traceFraction float64, origin string) func(context.Context) {
3838
var shutdownFuncs []func(context.Context) error
3939
// shutdown combines shutdown functions from multiple OpenTelemetry
4040
// components into a single function.
@@ -54,7 +54,8 @@ func initOTel(ctx context.Context, traceFraction float64) func(context.Context)
5454
resource.WithFromEnv(), // unpacks OTEL_RESOURCE_ATTRIBUTES
5555
// Add your own custom attributes to identify your application
5656
resource.WithAttributes(
57-
semconv.ServiceNameKey.String("tesseract"),
57+
semconv.ServiceNameKey.String(origin),
58+
semconv.ServiceNamespaceKey.String("tesseract"),
5859
),
5960
resource.WithDetectors(gcp.NewDetector()),
6061
)

0 commit comments

Comments
 (0)