[feature request] Make Kafka instrumentation more amenable to unit testing #2356
Labels
comp:instrumentation.confluentkafka
Things related to OpenTelemetry.Instrumentation.ConfluentKafka
enhancement
New feature or request
Component
OpenTelemetry.Instrumentation.ConfluentKafka
Is your feature request related to a problem?
I want to be able to unit test my application logic using mock IConsumer's instead of only being able to do E2E testing against a live Kafka instance.
I have code using the
IConsumer.ConsumeAndProcessMessageAsync
extension method and want to unit test it. I'm injecting an IConsumer mock into the DI container to facilitate that. That extension method throws an exception if consumer is not InstrumentedConsumer<TKey, TValue>, an internal class, preventing me from unit testing that code.What is the expected behavior?
There are multiple possible solutions, including making InstrumentedConsumer public or removing the unnecessary
consumer is not InstrumentedConsumer<TKey, TValue>
check from the extension method.Which alternative solutions or features have you considered?
Writing E2E tests (much slower and more complicated) or not testing my app logic, neither of which is appealing.
Additional context
No response
The text was updated successfully, but these errors were encountered: