Skip to content

Commit 12587cb

Browse files
committed
confluent-kafka: fix incorrect number of arguments
1 parent 9515f04 commit 12587cb

File tree

1 file changed

+10
-8
lines changed
  • instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka

1 file changed

+10
-8
lines changed

instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ def produce(self, topic, value=None, *args, **kwargs): # pylint: disable=keywor
132132

133133

134134
class AutoInstrumentedConsumer(Consumer):
135-
def __init__(self, config):
136-
super().__init__(config)
135+
def __init__(self, *args, **kwargs):
136+
super().__init__(*args, **kwargs)
137137
self._current_consume_span = None
138138

139139
# This method is deliberately implemented in order to allow wrapt to wrap this function
@@ -183,9 +183,9 @@ def __init__(self, consumer: Consumer, tracer: Tracer):
183183
self._current_consume_span = None
184184
self._current_context_token = None
185185

186-
def close(self):
186+
def close(self, *args, **kwargs):
187187
return ConfluentKafkaInstrumentor.wrap_close(
188-
self._consumer.close, self
188+
self._consumer.close, self, args, kwargs
189189
)
190190

191191
def committed(self, partitions, timeout=-1):
@@ -306,8 +306,10 @@ def _inner_wrap_consume(func, instance, args, kwargs):
306306
func, instance, self._tracer, args, kwargs
307307
)
308308

309-
def _inner_wrap_close(func, instance):
310-
return ConfluentKafkaInstrumentor.wrap_close(func, instance)
309+
def _inner_wrap_close(func, instance, args, kwargs):
310+
return ConfluentKafkaInstrumentor.wrap_close(
311+
func, instance, args, kwargs
312+
)
311313

312314
wrapt.wrap_function_wrapper(
313315
AutoInstrumentedProducer,
@@ -419,7 +421,7 @@ def wrap_consume(func, instance, tracer, args, kwargs):
419421
return records
420422

421423
@staticmethod
422-
def wrap_close(func, instance):
424+
def wrap_close(func, instance, args, kwargs):
423425
if instance._current_consume_span:
424426
_end_current_consume_span(instance)
425-
func()
427+
func(*args, **kwargs)

0 commit comments

Comments
 (0)