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

feat(opentelemetry-instrumentation-aiokafka): wrap getone instead of anext, add tests #2874

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dimastbk
Copy link
Contributor

@dimastbk dimastbk commented Sep 16, 2024

Description

Wrap getone instead of anext
Add tests for opentelemetry-instrumentation-aiokafka (#2082)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Does This PR Require a Core Repo Change?

  • Yes.
  • 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

@dimastbk dimastbk changed the title test: add tests for opentelemetry-instrumentation-aiokafka feat(opentelemetry-instrumentation-aiokafka): wrap getone instead of anext, add tests Sep 17, 2024
@dimastbk dimastbk marked this pull request as ready for review September 17, 2024 06:26
@dimastbk dimastbk requested a review from a team September 17, 2024 06:26

class TestAIOKafka(TestCase):
def test_instrument_api(self) -> None:
Copy link
Contributor

@xrmx xrmx Sep 17, 2024

Choose a reason for hiding this comment

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

I'm not sure you can keep async and sync tests on the same class. In the past I've fixed cases where the tests were not running and warnings were written in the console

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm. I've never encountered this, but I divided it into two test classes.

@@ -126,10 +126,10 @@ def _instrument(self, **kwargs):
)
wrap_function_wrapper(
aiokafka.AIOKafkaConsumer,
"__anext__",
_wrap_anext(tracer, async_consume_hook),
"getone",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we changing the wrapped function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

anext evaluate getone under the hood, and getone can be used directly.

@lzchen
Copy link
Contributor

lzchen commented Sep 18, 2024

@dimastbk

Would you mind adding yourself to component_owners.yml according to CONTRIBUTING.MD

@dimastbk
Copy link
Contributor Author

@lzchen done

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.

4 participants