Add OTel Logging Middleware - #211
Open
bauer-andreas wants to merge 5 commits into
Open
bauer-andreas wants to merge 5 commits into
bauer-andreas wants to merge 5 commits into
Conversation
…ndencies. The new middleware features are gated behind two new traits for Logging and OTelSemanticConventions
bauer-andreas
force-pushed
the
andreas-bauer/logging-middleware
branch
from
September 18, 2026 11:42
1c6ec82 to
e6cf52f
Compare
Contributor
|
This is great, @bauer-andreas! I've wanted us to have telemetry middlewares built-in, so thanks for getting this started. Since this has a pretty large API surface, and there are various smaller decisions that would benefit from more discussion, would you be open to writing up a proposal? We don't normally accept non-trivial new API without one. 🙏 |
czechboy0
requested changes
Sep 18, 2026
czechboy0
left a comment
Contributor
There was a problem hiding this comment.
Marking as needs-work for now, as we'll need to run a proposal for this first.
Contributor
|
Also cc @simonjbeaumont and @slashmo for visibility and additional thoughts. |
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.
Motivation
Instrumentation support varies based on the transport. Especially current Client Transport lack any sort of middleware. Therefore, it is useful to leverage the OpenAPI middleware system to provide constant emission of telemetry across client and server transports. The Open Telemetry Semantic Conventions is a widely established convention for metadata emission.
Modifications
ClientOTelLoggingMiddlewareandServerOTelLoggingMiddlewarefollowing Open Telemetry Semantic Conventions for HTTPLoggingandOTelSemanticConventiontrait that guards the two new dependencies on swift-log and swift-otel-semantic-conventions.Result
Consistent request and response logging across server and client implementations following OTel Semantic Conventions.
Test Plan
Added two new unit test suites that exercise both of the middleware using an in-memory logger that is injected via the new TaskLocal Logger form swift-log.