Repository navigation
feat: add opt-in OTLP trace export to the CLI - #2613
Open
ymotongpoo wants to merge 2 commits into
Open
ymotongpoo wants to merge 2 commits into
ymotongpoo wants to merge 2 commits into
Conversation
Initialize the SDK only when OTEL_TRACES_EXPORTER=otlp and keep telemetry setup/export failures separate from the command result. Test disabled behavior, both OTLP transports, parent-child context, resource configuration, cancellation, and exporter failures. Refs chainguard-dev#2609 Signed-off-by: Yoshi Yamaguchi <ymotongpoo@gmail.com>
Signed-off-by: Yoshi Yamaguchi <ymotongpoo@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The standalone CLI already creates OpenTelemetry spans internally, but it has no SDK/exporter initialization. This adds opt-in OTLP export so users can inspect those spans without modifying the CLI.
Closes #2609.
Behavior
OTEL_TRACES_EXPORTER=otlpenables a command root span and the existing internal spans. Export stays disabled by default;OTEL_SDK_DISABLED=truealso skips initialization.Validation
go test ./...,make test(all packages with the race detector), and golangci-lint 2.14 passed.make generateleft tracked generated files unchanged;go mod tidycompleted.--help,version, and a missing-config build against unmodified main. With VCS stamping disabled for comparison, stdout, stderr, and exit codes match.Hello, world!; Tempo returned 130 spans with one root and complete recorded parent relationships.disabled tracing changed the command context.Scope
Existing build logic and internal span placement stay unchanged. Propagating context between separate CLI invocations remains a separate proposal. This implements the compatibility policy discussed in the issue; transport and configuration choices remain open to maintainer feedback.