From 6e072276043ff4fb0d74749bb77dc521a42c79ec Mon Sep 17 00:00:00 2001 From: Damian Zaremba Date: Fri, 13 Dec 2024 14:02:43 +0000 Subject: [PATCH] honey - enable sampling --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index 0d7dd3e..0d5234a 100644 --- a/main.go +++ b/main.go @@ -120,6 +120,16 @@ func main() { otelconfig.WithServiceName("ClueBot NG"), } if configuration.Honey.Key != "" { + for k, v := range map[string]string{ + "OTEL_TRACES_SAMPLER": "traceidratio", + "OTEL_TRACES_SAMPLER_ARG": "0.5", + "OTEL_RESOURCE_ATTRIBUTES": "SampleRate=2", + } { + if err := os.Setenv(k, v); err != nil { + logrus.Warnf("failed to set sampling env var (%s -> %v): %s", k, v, err) + } + } + otelOptions = append(otelOptions, otelconfig.WithExporterProtocol(otelconfig.ProtocolHTTPProto)) otelOptions = append(otelOptions, otelconfig.WithExporterEndpoint("https://api.honeycomb.io")) otelOptions = append(otelOptions, otelconfig.WithHeaders(map[string]string{