From 1459437d12d5ed937314fe21ac651ae4ba5bc665 Mon Sep 17 00:00:00 2001 From: roman Date: Fri, 19 Apr 2024 22:30:12 +0000 Subject: [PATCH] propagate host name config to Sentry --- CHANGELOG.md | 2 ++ app/main.go | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d265c782..d029918b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## v0.17.5 + ## v0.17.4 - Cache no candidate or ranked routes diff --git a/app/main.go b/app/main.go index 0792fae2..8b6f8c8b 100644 --- a/app/main.go +++ b/app/main.go @@ -31,6 +31,8 @@ import ( func main() { configPath := flag.String("config", "config.json", "config file location") + hostName := flag.String("host", "sqs", "the name of the host") + isDebug := flag.Bool("debug", false, "debug mode") if *isDebug { log.Println("Service RUN on DEBUG mode") @@ -94,6 +96,7 @@ func main() { ) err = sentry.Init(sentry.ClientOptions{ + ServerName: *hostName, Dsn: otelConfig.DSN, SampleRate: otelConfig.SampleRate, EnableTracing: otelConfig.EnableTracing, @@ -109,7 +112,7 @@ func main() { sentry.CaptureMessage("SQS started") - initOTELTracer() + initOTELTracer(*hostName) } chainClient, err := client.NewClient(config.ChainID, config.ChainGRPCGatewayEndpoint) @@ -158,7 +161,7 @@ func main() { // initOTELTracer initializes the OTEL tracer // and wires it up with the Sentry exporter. -func initOTELTracer() { +func initOTELTracer(hostName string) { exporter, err := stdouttrace.New(stdouttrace.WithPrettyPrint()) if err != nil { log.Fatalf("stdouttrace.New: %v", err) @@ -166,7 +169,7 @@ func initOTELTracer() { resource, err := resource.New(context.Background(), resource.WithAttributes( - semconv.ServiceNameKey.String("sqs"), + semconv.ServiceNameKey.String(hostName), ), ) if err != nil {