chore(instrumentation-http): provide http.request.header.<key> at server span creation time#6396
Open
vitorvasc wants to merge 3 commits intoopen-telemetry:mainfrom
Open
chore(instrumentation-http): provide http.request.header.<key> at server span creation time#6396vitorvasc wants to merge 3 commits intoopen-telemetry:mainfrom
http.request.header.<key> at server span creation time#6396vitorvasc wants to merge 3 commits intoopen-telemetry:mainfrom
Conversation
…an creation time Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6396 +/- ##
=======================================
Coverage 95.50% 95.50%
=======================================
Files 365 365
Lines 11609 11609
Branches 2677 2677
=======================================
Hits 11087 11087
Misses 522 522 🚀 New features to boost your workflow:
|
Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
Signed-off-by: Vitor Vasconcellos <vitor.vasconcellos@mercadolivre.com>
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.
Which problem is this PR solving?
The HTTP semconv spec states that
http.request.header.<key>SHOULD be provided at span creation time, as it can be important for making sampling decisions. The current behavior is thatinstrumentation-httponly captures server hequest headers after span creation inside thecontext.with()callback.Fixes #6393
Short description of the changes
headerCaptureinutils.tsto return anAttributesobject instead of callingspan.setAttribute()directly.http.tsto before_startHttpSpan, merging the captured attributes intospanOptions.attributesso they are available at span creation time.span.setAttributes()with the returned attributes.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
npm run testin@opentelemetry/instrumentation-http)npm run lint)Checklist: