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 headers for properties in pika #740

Conversation

oxeye-nikolay
Copy link
Member

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

Description

The pika instrumentation injects the context into the properties.headers of the connection. If the properties are not provided, it generates a new BasicProperties object, which by default sets headers to None instead of an empty dict - which results in a failure to inject the context into the headers.
The fix was to set the headers={} by default when creating the BasicProperties object.

Type of change

Please delete options that are not relevant.

  • 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

A pika client that creates a pika connection and executes basic_publish without properties.

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

@oxeye-nikolay oxeye-nikolay requested a review from a team October 14, 2021 17:59
ctx = propagate.extract(properties.headers, getter=_pika_getter)
if not ctx:
ctx = context.get_current()
span = _get_span(
tracer,
channel,
properties,
span_kind=SpanKind.CLIENT,
Copy link
Contributor

Choose a reason for hiding this comment

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

shoudl this be producer/consumer instead of client/server?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess you're right as pika does use callbacks. Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is more about the communication being a single round-trip like HTTP vs async message queue one like RabbitMQ. I'm guessing pika enables the later type of communication, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, You create a single connection and declare one or many channels, over which you declare one or many callbacks. So it is more of a producer/consumer than client/server.

@owais owais requested a review from a team October 17, 2021 12:06
@owais owais merged commit bf41b2e into open-telemetry:main Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants