opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Fixing w3c baggage support in opentelemetry-instrumentation-aws-lambda

Open dtorok opened this issue 1 year ago • 3 comments
trafficstars

Description

Fixing baggage support in opentelemetry-instrumentation-aws-lambda package.

After determining the parent context (_determine_parent_context()), it was only used to create the wrapper span, but wasn't attached to the global context. Although the start_as_current_span() call attaches the span's context, but because the SpanContext only contains span-related info, the baggage content was lost, and the propagators couldn't pick it up. This change attaches/detaches the baggage to the context in a try/finally clause. Other instrumentations do the same either directly, or through _start_internal_or_server_span().

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Implemented a unit test, and ran all the relevant tests:

tox -e lint-instrumentation-aws-lambda
tox -e py38-test-instrumentation-aws-lambda
tox -e py39-test-instrumentation-aws-lambda
tox -e py310-test-instrumentation-aws-lambda
tox -e py311-test-instrumentation-aws-lambda

Does This PR Require a Core Repo Change?

  • [x] No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • [x] Followed the style guidelines of this project
  • [x] Changelogs have been updated
  • [x] Unit tests have been added
  • [ ] Documentation has been updated

dtorok avatar Jun 07 '24 08:06 dtorok

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: dtorok / name: Daniel Torok (eb7f7ec3228c66141c212f30ab0af38d59dd9d94, 47eb88f27810d3688e3fb7c35b6031883d94767e, d74534fd93384fc82603107ce5b48e1b7f451ca1, 6c939000a60cd72a8c69e6f4430d677b60eb44cb)

LGTM!

@nemoshlag @NathanielRN

wangzlei avatar Jun 12 '24 05:06 wangzlei

@dtorok please rebase and move the CHANGELOG entry to a new unreleased section

xrmx avatar Jul 25 '24 08:07 xrmx