Skip to content
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

Bugfix/set default context in pika #719

Merged

Conversation

oxeye-nikolay
Copy link
Member

@oxeye-nikolay oxeye-nikolay commented Oct 10, 2021

Description

This PR fixes a bug in the pika instrumentation library. When the propagator could not detect a context from the message headers (for example in the sending action properties.headers) the context would be set to {} instead of the current context - thus breaking the trace chain.

Type of change

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

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Unit tests
  • Maunal Instrumentation test

Does This PR Require a Core Repo Change?

  • No.

Checklist:

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

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

@oxeye-nikolay oxeye-nikolay requested a review from a team October 10, 2021 13:00
@oxeye-nikolay oxeye-nikolay removed their assignment Oct 10, 2021
@owais
Copy link
Contributor

owais commented Oct 10, 2021

The patch looks fine but I'm now a bit confused about the overall design of the instrumentation. It looks like we are trying to extract span from properties.headers and then immediately after that are trying inject context again into the same thing.

Generally we'd want to instrument two sets of functions. Functions that get/retrieve a message from some bus/queue (receivers) and functions that would send messages to a bus (senders). Generally, receivers should extract context from incoming messages, start a span and set it in the current context. The senders should just start a span and inject its context into the outgoing message. In this implementation it looks like we are extracting from and injecting into the same message.

@@ -41,15 +41,20 @@ def decorated_callback(
) -> Any:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So _decorate_callback wraps the "receive" functionality only?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it wraps all the callbacks in the _consumers dict

@owais owais added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Oct 11, 2021
@owais
Copy link
Contributor

owais commented Oct 11, 2021

Skipped changelog as this component has not been released yet so the first release should only contain one changelog entry for this.

@owais
Copy link
Contributor

owais commented Oct 11, 2021

Docker tests are failing for unrelated reasons and need to be looked at separately. This PR has approvals and passes the relevant checks so merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants