-
Notifications
You must be signed in to change notification settings - Fork 683
Instrumentation for AIOKafka #1957
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
Conversation
|
@awtkns Any update on when can this be merged? |
AIOKafkaProducer, "send", _wrap_send(tracer, produce_hook) | ||
) | ||
wrap_function_wrapper( | ||
AIOKafkaConsumer, |
There was a problem hiding this comment.
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?
Hi! Is there any updates on this? |
|
||
|
||
def _wrap_send(tracer: Tracer, produce_hook: ProduceHookT) -> Callable: | ||
def _traced_send(func, instance: AIOKafkaProducer, args, kwargs): |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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__") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwrap(AIOKafkaConsumer, "__next__") | |
unwrap(AIOKafkaConsumer, "__anext__") |
@awtkns Any update on when can this be merged? |
Hi @awtkns, any news on this PR ? |
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.12?
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.
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
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.