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

Instrumentation for AIOKafka #1957

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

awtkns
Copy link

@awtkns awtkns commented Sep 17, 2023

WIP

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

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?

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

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • 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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 17, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: awtkns / name: Adam Watkins (5072ab8)

@SanketDG
Copy link

SanketDG commented Nov 1, 2023

@awtkns Any update on when can this be merged?

AIOKafkaProducer, "send", _wrap_send(tracer, produce_hook)
)
wrap_function_wrapper(
AIOKafkaConsumer,
Copy link

Choose a reason for hiding this comment

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

Should getone and getmany be patched as well?

@marcosschroh
Copy link

Hi! Is there any updates on this?



def _wrap_send(tracer: Tracer, produce_hook: ProduceHookT) -> Callable:
def _traced_send(func, instance: AIOKafkaProducer, args, kwargs):
Copy link

Choose a reason for hiding this comment

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

should this be async?

SpanAttributes.MESSAGING_DESTINATION: topic,
SpanAttributes.MESSAGING_URL: json.dumps(bootstrap_servers),
SpanAttributes.MESSAGING_DESTINATION_KIND: "topic",
SpanAttributes.MESSAGING_KAFKA_CLIENT_ID: client_id,
Copy link

Choose a reason for hiding this comment

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

This should be SpanAttributes.MESSAGING_CLIENT_ID as MESSAGING_KAFKA_CLIENT_ID has been deprecated

_get_span_name,
_kafka_getter,
_kafka_setter,
_wrap_next,
Copy link

Choose a reason for hiding this comment

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

_wrap_anext here?


from opentelemetry.instrumentation.aiokafka.utils import (
KafkaPropertiesExtractor,
_create_consumer_span,
Copy link

Choose a reason for hiding this comment

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

where is this _create_consumer_span?

partition = KafkaPropertiesExtractor.extract_send_partition(args, kwargs)
client_id = KafkaPropertiesExtractor.extract_client_id(instance.client)

span_name = _get_span_name("publish", topic)
Copy link

Choose a reason for hiding this comment

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

I would use send here. As test_utils is using also send and it would be align with python-kafka


def _uninstrument(self, **kwargs):
unwrap(AIOKafkaProducer, "send")
unwrap(AIOKafkaConsumer, "__next__")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
unwrap(AIOKafkaConsumer, "__next__")
unwrap(AIOKafkaConsumer, "__anext__")

@dmastapkovich
Copy link

@awtkns Any update on when can this be merged?

@CodeCoral
Copy link

Hi @awtkns, any news on this PR ?

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.

7 participants