Skip to content

Instrumentation for AIOKafka's getmany method #3087

Closed
@psharrma

Description

@psharrma

Describe your environment

OS: ALL
Python version: > Python 3.8
Package version: (opentelemetry-instrumentation-aiokafka==0.49b2)

What happened?

I am using faust-streaming as Kafka consumer. It internally uses aioKafka.getmany method.

However it seems AIOKafkaInstrumentor only wraps getone method. Hence the span flow is broken in our application.

Steps to Reproduce

if settings.IS_OPENTELEMETRY_ENABLED:
#Initialise Open Telemetry
resource = Resource(attributes={SERVICE_NAME: settings.PROJECT_NAME})
traceProvider = TracerProvider(resource=resource)
if settings.IS_OPENTELEMETRY_ENABLED:
AIOKafkaInstrumentor().instrument()

    processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=settings.OTLP_URI))
    traceProvider.add_span_processor(processor)
    # Sets the global default tracer provider
    trace.set_tracer_provider(traceProvider)
#End Initialise Open Telemetry

app = faust.App(
'hello-world',
broker='aiokafka://localhost:9092',
value_serializer='raw',
)

greetings_topic = app.topic('greetings')

@app.agent(greetings_topic)
async def greet(greetings):
async for greeting in greetings:
print(greeting)

Expected Result

Should see the span extending till the faust consumer.

Actual Result

Faust Consumer, records it as a new parent span.

Additional context

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions