-
Notifications
You must be signed in to change notification settings - Fork 32
✨ Add x-osparc-trace-id to response headers for requests hitting webserver and api-server
#7796
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
✨ Add x-osparc-trace-id to response headers for requests hitting webserver and api-server
#7796
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7796 +/- ##
==========================================
- Coverage 87.97% 87.86% -0.11%
==========================================
Files 1844 1428 -416
Lines 70996 59256 -11740
Branches 1213 618 -595
==========================================
- Hits 62460 52068 -10392
+ Misses 8193 6983 -1210
+ Partials 343 205 -138
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
osparc-trace-id to response headers to requests hitting webserver and api-serverx-osparc-trace-id to response headers to requests hitting webserver and api-server
x-osparc-trace-id to response headers to requests hitting webserver and api-serverx-osparc-trace-id to response headers for requests hitting webserver and api-server
|
@odeimaiz, @mguidon and @wvangeit I request a review from you guys mainly to notify you about these changes. This should be very useful to you when working on the "client side" of the api-server. Note that Jaeger is available in the local deployment, so there you can investigate traces. Let me know if you want me to show you how this is useful to you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new feature that propagates a trace identifier (x-osparc-trace-id) in response headers for both the API server and webserver, enabling easier log association and trace inspection.
- Propagates the trace id header by updating tracing setup functions in both the webserver and API server.
- Introduces new middleware for FastAPI and aiohttp to attach the trace id header on responses.
- Updates and adds tests to cover the new header behavior.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| services/web/server/src/simcore_service_webserver/tracing.py | Enables trace id header propagation in webserver tracing configuration. |
| services/api-server/src/simcore_service_api_server/core/application.py | Updates tracing initialization to pass the header propagation flag. |
| packages/service-library/tests/fastapi/test_tracing.py | Adds tests to ensure the trace id header is present in responses. |
| packages/service-library/tests/fastapi/conftest.py | Adjusts fixtures to support the updated tracing behavior. |
| packages/service-library/tests/aiohttp/test_tracing.py | Adds similar tests for aiohttp server responses. |
| packages/service-library/tests/aiohttp/conftest.py | Provides a fixture for in-memory span exporter used in aiohttp tests. |
| packages/service-library/src/servicelib/tracing.py | Defines the trace id header constant and helper to generate it. |
| packages/service-library/src/servicelib/fastapi/tracing.py | Introduces middleware to attach the trace id header in FastAPI responses. |
| packages/service-library/src/servicelib/aiohttp/tracing.py | Adds middleware logic for injecting the trace id header in aiohttp responses. |
sanderegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool
wvangeit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, thanks.
YuryHrytsuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
|



What do these changes do?
x-osparc-trace-idheader. I have investigated online at it seems there is no standardized approach to propagating this info to the outside world within opentelemetry (see links in Add osparc trace id in response headers outside the platform #7795). In some AWS services they have aX-Amzn-Trace-Idand I have copied that approach.Here's what this looks like in the api-server
And here's what it looks like in the frontend (webserver)
🚨 @matusdrobuliak66 don't worry, I will not merge this until after the release.
Related issue/s
How to test
Dev-ops