Repository navigation
Conversation
Error and interrupt paths exit through clients.Os.Exit, which skips the deferred span.Finish and reporter Close in main.go. Adds tracer.Flush and calls it before each of those exits so the root span is sent.
A Ctrl+C during the InitConfig error-path flush made the second Flush return early and exit while the reporter was still closing.
Replaces the archived jaeger-client-go reporter with the OpenTelemetry SDK and OTLP exporter, sending to slackb.com/traces/v1/otlp. The OpenTracing bridge keeps every existing span call working unchanged.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #822 +/- ##
==========================================
+ Coverage 80.46% 80.57% +0.10%
==========================================
Files 246 246
Lines 18882 18913 +31
==========================================
+ Hits 15194 15239 +45
+ Misses 3688 3674 -14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The OTLP exporter and SDK read OTEL_EXPORTER_OTLP_HEADERS, INSECURE, OTEL_RESOURCE_ATTRIBUTES, and OTEL_TRACES_SAMPLER from the developer's shell, which could send their own collector credentials or attributes to slackb.com. Pins every exporter option, the resource, and the sampler instead.
OTEL_BSP_MAX_QUEUE_SIZE=-1 panicked in SetupTracer and 0 dropped every span.
A malformed OTEL_EXPORTER_OTLP_* variable in the developer's shell printed parse errors on every command.
zimeg
left a comment
There was a problem hiding this comment.
🔭 @mwbrooks Exciting to move tracing off the archived Jaeger client! The OTEL_* guards are really thoughtful, and dropping the raw hostname and ip tags from spans is a nice privacy win.
📚 suggestion: AGENTS.md still describes tracing as "OpenTracing (Jaeger)" so let's update that line with this change too.
| // SetupTracer sets up the tracer to send data to honeycomb with OpenTelemetry | ||
| func SetupTracer(isDev bool) (io.Closer, opentracing.Tracer) { | ||
| var collectorEndpoint = "https://slackb.com/traces/v1/jaeger" | ||
| var collectorEndpoint = "https://slackb.com/traces/v1/otlp" |
There was a problem hiding this comment.
❓ question: The testing notes mention dev.slackb.com, but main.go always calls SetupTracer(false). Have spans from a build pointed here shown up in Honeycomb with the service_name queries still matching? Since export errors are dropped, I think a check on the receiving end is the only signal before release.
There was a problem hiding this comment.
Not in Honeycomb yet, I can't reach it from here. A build of this branch pointed at dev.slackb.com sent trace e4c9fb598d7cb43fd699407882a85a41 (session 85e6fbd5-1820-4d0f-aa2d-ea8f78326aca) at 05:55 UTC on 2026-11-21, and the exporter returned no errors. I'll hold the merge until we see it there with service_name = slack-cli matching 👀
| sdktrace.WithBatchTimeout(sdktrace.DefaultScheduleDelay*time.Millisecond), | ||
| sdktrace.WithExportTimeout(sdktrace.DefaultExportTimeout*time.Millisecond), | ||
| ), | ||
| sdktrace.WithSampler(sdktrace.AlwaysSample()), |
There was a problem hiding this comment.
🔭 thought: The span limits still read OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, and friends from the environment. Perhaps we pin these to the defaults too, to match the other guards?
| sdktrace.WithSampler(sdktrace.AlwaysSample()), | |
| sdktrace.WithSampler(sdktrace.AlwaysSample()), | |
| // The defaults, set here so OTEL_*_LIMIT environment variables can't change them | |
| sdktrace.WithRawSpanLimits(sdktrace.SpanLimits{ | |
| AttributeValueLengthLimit: sdktrace.DefaultAttributeValueLengthLimit, | |
| AttributeCountLimit: sdktrace.DefaultAttributeCountLimit, | |
| EventCountLimit: sdktrace.DefaultEventCountLimit, | |
| LinkCountLimit: sdktrace.DefaultLinkCountLimit, | |
| AttributePerEventCountLimit: sdktrace.DefaultAttributePerEventCountLimit, | |
| AttributePerLinkCountLimit: sdktrace.DefaultAttributePerLinkCountLimit, | |
| }), |
Changelog
N/A - internal tracing change with no user-facing changes.
Summary
This pull request sends the CLI's traces with OpenTelemetry instead of the archived
jaeger-client-go, so maintainers keep tracing on a library that still gets fixes. Traces now go toslackb.com/traces/v1/otlp, the OTLP endpoint other Slack services already use, and every existing span call keeps working through the OpenTracing bridge.SetupTracerbuilds an OpenTelemetryTracerProviderwith a batching OTLP exporter and registers the bridge as the global OpenTracing tracerservice.nameand add aservice_nameresource attribute, because the Jaeger endpoint set that tag and Honeycomb queries filter on ithostnameandiptags thatjaeger-client-goadded on its own.hashed_hostnamestaysSetTraceHeadersandTraceIDnow inject through a B3 propagator, andx-b3-sampledstays0OTEL_*variables. The SDK readsOTEL_EXPORTER_OTLP_HEADERS,OTEL_EXPORTER_OTLP_INSECURE,OTEL_RESOURCE_ATTRIBUTES,OTEL_TRACES_SAMPLER, andOTEL_BSP_*, which would send someone's collector credentials or attributes to slackb.com, or crash the CLI withOTEL_BSP_MAX_QUEUE_SIZE=-1. Every exporter option, the resource, the sampler, and the batch options are pinned instead, and OpenTelemetry's internal logger is discarded so a malformed variable prints nothingFlushshuts the provider down with a 2s timeoutBuilds on #819, which added the flush before exit that the batching exporter needs.
Testing
SetupTracerat a local HTTP server that logs each POST (addotlptracehttp.WithInsecure()), then build./bin/slack versionand./bin/slack notacommand, and confirm each sends one protobuf POST to/traces/v1/otlpwith themainspan./bin/slack version, and confirm nothing new prints to stderrgo test ./internal/tracer/ -run Test_newProvider, which sets thoseOTEL_*variables and checks the export has noauthorizationheader, no extra resource attributes, and still goes over TLSNotes
mainspan withservice.nameandservice_name, and the payload had no raw hostnamedev.slackb.comforversionandnotacommand, and the exporter reported no errorsx-b3-traceidas an opaque string (src/tracing/TraceContext.hack)x-b3-parentspanidis no longer sent, because OpenTelemetry span contexts don't carry a parent ID. webapp ignores that headerOTEL_RESOURCE_ATTRIBUTES,OTEL_EXPORTER_OTLP_HEADERS, andOTEL_TRACES_SAMPLER=always_offset: the payload had only the twoserviceattributes and still nested every span undermaingo.sum, well over the usual size for this series. The exporter swap and theOTEL_*guards can't land separately without leaking a developer's settings to slackb.com in between. It also dropsjaeger-client-gofromgo.modRequirements