feat(@effect/platform): add tracer header filter combinators to HttpClient#6215
Closed
Zelys-DFKH wants to merge 1 commit intoEffect-TS:mainfrom
Closed
feat(@effect/platform): add tracer header filter combinators to HttpClient#6215Zelys-DFKH wants to merge 1 commit intoEffect-TS:mainfrom
Zelys-DFKH wants to merge 1 commit intoEffect-TS:mainfrom
Conversation
…rResponseHeadersFilter, and withTracerHeadersFilter to HttpClient Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: f9b1fe7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Effect v3 is under a feature freeze, feel free to move this contribution to the effect-smol repository. |
5 tasks
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.
Type
Description
Closes #6198.
HttpClientcurrently records every request and response header as an OTEL span attribute with no way to filter them. If you've ever looked at a span from a Notion API call and seen 30+ entries (cf-ray,alt-svc,server,x-cache,strict-transport-security, all the CDN noise), you know exactly why this matters. Sensitive headers like cookies and auth tokens end up in trace backends too, which is the harder problem.This PR adds three combinators:
withTracerRequestHeadersFilter(predicate): filter which request headers are recorded as span attributeswithTracerResponseHeadersFilter(predicate): filter which response headers are recorded as span attributeswithTracerHeadersFilter(predicate): set the same predicate for both at once (the common case)Each combinator is backed by a
FiberRef, so the filter scopes to the effect it wraps and doesn't bleed into other clients. The default isconstTrue, so existing behavior is unchanged.The implementation follows the same
FiberRef+globalValue+dual+transformResponsepattern aswithTracerDisabledWhenandwithTracerPropagation. Once I found those, the rest slotted in pretty naturally.I went with three functions instead of one because request and response filtering are genuinely independent needs. You might want to capture all request headers for debugging but strip CDN noise from responses, or vice versa. Happy to collapse to a single combinator if you'd prefer a smaller API surface.
Thanks for building Effect — it's a genuinely well-designed library and I'm glad to contribute back.
Related