diff --git a/cmd/gcp/main.go b/cmd/gcp/main.go index cffee95c..8dc1c674 100644 --- a/cmd/gcp/main.go +++ b/cmd/gcp/main.go @@ -70,7 +70,7 @@ func main() { flag.Parse() ctx := context.Background() - shutdownOTel := initOTel(ctx, *traceFraction) + shutdownOTel := initOTel(ctx, *traceFraction, *origin) defer shutdownOTel(ctx) signer, err := NewSecretManagerSigner(ctx, *signerPublicKeySecretName, *signerPrivateKeySecretName) diff --git a/cmd/gcp/otel.go b/cmd/gcp/otel.go index dd0f12b1..592fb033 100644 --- a/cmd/gcp/otel.go +++ b/cmd/gcp/otel.go @@ -34,7 +34,7 @@ import ( // // Tracing is enabled with statistical sampling, with the probability passed in. // Returns a shutdown function which should be called just before exiting the process. -func initOTel(ctx context.Context, traceFraction float64) func(context.Context) { +func initOTel(ctx context.Context, traceFraction float64, origin string) func(context.Context) { var shutdownFuncs []func(context.Context) error // shutdown combines shutdown functions from multiple OpenTelemetry // components into a single function. @@ -54,7 +54,8 @@ func initOTel(ctx context.Context, traceFraction float64) func(context.Context) resource.WithFromEnv(), // unpacks OTEL_RESOURCE_ATTRIBUTES // Add your own custom attributes to identify your application resource.WithAttributes( - semconv.ServiceNameKey.String("tesseract"), + semconv.ServiceNameKey.String(origin), + semconv.ServiceNamespaceKey.String("tesseract"), ), resource.WithDetectors(gcp.NewDetector()), )