feat(frontend): propagate trace context via OpenAPI interceptor#16
Open
ncolesummers wants to merge 6 commits into
Open
feat(frontend): propagate trace context via OpenAPI interceptor#16ncolesummers wants to merge 6 commits into
ncolesummers wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an explicit OpenTelemetry trace-context propagation hook to the frontend’s generated OpenAPI client so backend requests carry W3C traceparent/tracestate without modifying generated client sources.
Changes:
- Introduce
frontend/src/telemetry-interceptor.tsto inject W3C trace context into OpenAPI client requests viaOpenAPI.interceptors.request. - Register the interceptor during app startup in
frontend/src/main.tsxafter telemetry initialization. - Update
docs/observability.mdto describe the propagation approach and add a troubleshooting check.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| frontend/src/telemetry-interceptor.ts | New interceptor + one-time registration helper to inject traceparent/tracestate into request headers. |
| frontend/src/main.tsx | Calls registerTraceContextInterceptor() after initTelemetry(). |
| docs/observability.md | Updates trace propagation explanation and adds a troubleshooting step for interceptor registration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Path in route declaration
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
frontend/src/telemetry-interceptor.tsto inject W3C trace context (traceparent/tracestate) into every generated OpenAPI client request viaOpenAPI.interceptors.requestfrontend/src/main.tsximmediately after telemetry initializationWhy
Issue #6 requires frontend-to-backend distributed trace continuity without modifying generated client files under
frontend/src/client/.Validation
bun run --cwd frontend buildpassestraceparent: 00-9d901eba971201dd7b4e5ed1a8f87529-22ed13efe1b40b13-019d901eba971201dd7b4e5ed1a8f87529includes both services (react-frontend,fastapi-backend)GET /api/v1/users/mehas parent span ID22ed13efe1b40b13(matching the frontend client span ID fromtraceparent)Closes #6