-
Notifications
You must be signed in to change notification settings - Fork 20
feat: add nested phase spans for OpenTelemetry tracing #298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
corneliusludmann
wants to merge
13
commits into
cornelius/clc-2106-add-opentelemetry-sdk-with-buildpackage-spans-and-trace
Choose a base branch
from
cornelius/clc-2107-add-build-phase-spans-with-error-and-log-capture
base: cornelius/clc-2106-add-opentelemetry-sdk-with-buildpackage-spans-and-trace
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Add OpenTelemetry infrastructure for distributed tracing with support for W3C Trace Context propagation from CI systems. - Add telemetry package with tracer initialization, shutdown, and trace context parsing - Implement OTelReporter with build and package span creation - Add CLI flags: --otel-endpoint, --trace-parent, --trace-state - Capture build metrics, package timing, and GitHub Actions context - Thread-safe concurrent package builds with RWMutex - Graceful degradation when tracing fails - Comprehensive tests with in-memory exporters - Documentation in docs/observability.md and README.md Closes CLC-2106 Co-authored-by: Ona <no-reply@ona.com>
Enable Docker support in the development container for building and testing Docker packages. Co-authored-by: Ona <no-reply@ona.com>
Move tracer shutdown from getBuildOpts to build command Run function to ensure spans are flushed after the build completes, not immediately after getBuildOpts returns. - Change getBuildOpts to return shutdown function - Update all callers to handle the new return value - Set OTEL_EXPORTER_OTLP_ENDPOINT from CLI flag before InitTracer Tested with Jaeger and confirmed traces are now properly sent. Co-authored-by: Ona <no-reply@ona.com>
- Fix errcheck warnings in test files (check tp.Shutdown errors) - Fix errcheck warnings for os.Setenv/Unsetenv in tests - Run go fmt on modified files Co-authored-by: Ona <no-reply@ona.com>
Add comprehensive tests for GitHub Actions environment variable handling: - TestOTelReporter_GitHubAttributes: Verifies all 10 GitHub attributes are correctly added to spans when running in GitHub Actions - TestOTelReporter_NoGitHubAttributes: Verifies no GitHub attributes are added when not running in GitHub Actions Coverage improvement: - addGitHubAttributes: 9.1% → 100% Co-authored-by: Ona <no-reply@ona.com>
Change InitTracer to accept endpoint as parameter instead of reading from environment variable. This improves testability and follows separation of concerns. Changes: - InitTracer now takes endpoint as parameter: InitTracer(ctx, endpoint) - Remove confusing env var manipulation in cmd/build.go - Simplify test (no need to manipulate environment) - Make configuration flow clearer: flag → function parameter Benefits: - Easier to test (no env var side effects) - Clearer API (explicit parameter vs implicit env var) - Consistent with other reporters (e.g., SegmentReporter) - No circular dependency between flag default and env var Co-authored-by: Ona <no-reply@ona.com>
- Add OTEL_EXPORTER_OTLP_INSECURE env var and --otel-insecure flag - Default to secure TLS connections (production-ready) - Fix version retrieval to use actual leeway.Version - Update documentation with Honeycomb production examples - Add TLS configuration section to observability docs Addresses review feedback on PR #288 Co-authored-by: Ona <no-reply@ona.com>
- Remove docs/README.md (unnecessary file) - Shorten OpenTelemetry section in README.md - Link to detailed observability.md documentation Addresses review comments on PR #288 Co-authored-by: Ona <no-reply@ona.com>
- Document that SDK automatically reads OTEL_EXPORTER_OTLP_HEADERS - Add OTEL_EXPORTER_OTLP_TRACES_HEADERS to environment variables list - Clarify no additional code configuration is required - Improve Honeycomb example description Co-authored-by: Ona <no-reply@ona.com>
Not needed for the PR Co-authored-by: Ona <no-reply@ona.com>
- Fix trailing whitespace in reporter_otel_test.go - Update observability.md to accurately reflect current implementation - Clarify that phase durations are captured as attributes, not spans - Move phase-level spans to future enhancements section Co-authored-by: Ona <no-reply@ona.com>
- Add 6 new test functions covering error handling, test coverage attributes, phase durations, package status counts, and memory cleanup - Verify memory management: packageSpans and packageCtxs maps are properly cleaned up after PackageBuildFinished - Fix whitespace consistency in cmd/build.go (use tabs instead of spaces) - All 13 OTelReporter tests passing Co-authored-by: Ona <no-reply@ona.com>
Add PhaseAwareReporter optional interface to enable phase-level span creation without breaking existing reporters. Phase spans are created as children of package spans for detailed build timeline visualization. Changes: - Define PhaseAwareReporter interface with phase start/finish methods - Implement phase span tracking in OTelReporter - Modify executeBuildPhase to call phase-aware reporters via type assertion - Remove phase duration attributes (now captured in nested spans) - Add comprehensive phase span tests - Update documentation with span hierarchy and phase attributes Closes CLC-2107 Co-authored-by: Ona <no-reply@ona.com>
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.
What
Add nested phase spans to OpenTelemetry tracing for detailed build timeline visualization.
Why
Phase spans provide:
Changes
Core Implementation
io.Closer,io.Seeker)PackageBuildPhaseStarted(pkg, phase)- creates phase spanPackageBuildPhaseFinished(pkg, phase, err)- ends phase span with error statusPhaseAwareReporterphaseSpans map[string]trace.Spanfor trackingSpan Hierarchy
Phase Span Attributes
leeway.phase.nameSpan Status:
OK: Phase completed successfullyERROR: Phase failed (error details in span events)Testing
reporter_otel_phase_test.gowith 5 comprehensive tests:TestOTelReporter_PhaseDurationsto verify phase spansDocumentation
README.mdwith span hierarchy diagramdocs/observability.mdwith:Design Decisions
ReporterinterfaceOTelReporterimplements phase trackingsync.RWMutexRelated
Closes CLC-2107
Depends on #288 (CLC-2106)