feat: OpenTelemetry tracing, API versioning, pagination & config enhancements#51
Open
GabrielTenma wants to merge 6 commits into
Open
feat: OpenTelemetry tracing, API versioning, pagination & config enhancements#51GabrielTenma wants to merge 6 commits into
GabrielTenma wants to merge 6 commits into
Conversation
…buffer Add ResetTerminal function in pkg/utils/system.go to emit the escape sequence restoring the main screen buffer, cursor, and text attributes. Update ClearScreen in both pkg/utils/system.go and scripts/build/build.go to call ResetTerminal before performing platform-specific clears, and adjust the defer cleanup in runTUIBuild to also restore the main buffer. Apply similar startup clearing in scripts/docker/docker_build.go and scripts/plugin/pkg.go for consistent terminal state handling across all tools.
Records request count, duration, and sizes using the route template (c.Path()) for bounded label cardinality.
- New pkg/tracer/ — OTLP HTTP tracing with samplers, span creation, W3C traceparent propagation - New internal/middleware/versioning.go — Accept-Version header parsing, version context, deprecation headers (Warning/Deprecation/Sunset), version route groups - Add TracingConfig (enabled, sample_rate, otlp_endpoint) to config - Wire tracer init in server.go with trace middleware - Add tracing section to config.yaml - Add PaginationConfig, InfrastructureConfig to config (from previous commit) - Add MetricsConfig.SampleRate for sampled metrics Already present in codebase (no new code needed): - RequestID middleware — generates X-Request-ID when missing - Audit logging middleware — structured request/response logging - Rate limiting with per-endpoint config support
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.
Summary
Implements OpenTelemetry tracing and API versioning middleware for stackyrd.
1. OpenTelemetry Tracing (pkg/tracer/)
tracing.enabled,tracing.sample_rate,tracing.otlp_endpoint2. API Versioning (internal/middleware/versioning.go)
Accept-Versionheader or?version=query paramX-API-Versionresponse headerWarning,Deprecation,Sunset,Link(rel="sunset")/v{version}/3. Config Updates (config/config.go)
TracingConfig: enabled, sample_rate, otlp_endpointPaginationConfig: type (offset/cursor), max_per_pageInfrastructureConfig: init_timeout (per-component health check timeout)MetricsConfig.SampleRate: fractional metrics sampling4. Server Integration (internal/server/server.go)
initTracing(): Initializes tracer, registers middleware/healthnow returnsinit_timeout_secondsAlready Present (no new code)
X-Request-IDwhen missingConfig Example