Skip to content

Commit c1fe016

Browse files
papigersxrmx
andauthored
fix: confluent-kafka: fix incorrect number of arguments (#3922)
* confluent-kafka: fix incorrect number of arguments * update confluent-kafka dep * changelog --------- Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
1 parent 315043a commit c1fe016

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

  • instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9494
([#4081](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4081))
9595
- `opentelemetry-instrumentation-system-metrics`: Use proper numeric `cpython.gc.generation` attribute in CPython metrics, out of spec `generation` attribute is deprecated and will be removed in the future
9696
([#4092](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4092))
97+
- `opentelemetry-instrumentation-confluent-kafka`: Fix incorrect number of argument to `_inner_wrap_close`
98+
([#3922](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3922))
9799

98100
### Breaking changes
99101

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
@@ -134,8 +134,8 @@ def produce(self, topic, value=None, *args, **kwargs): # pylint: disable=keywor
134134

135135

136136
class AutoInstrumentedConsumer(Consumer):
137-
def __init__(self, config):
138-
super().__init__(config)
137+
def __init__(self, *args, **kwargs):
138+
super().__init__(*args, **kwargs)
139139
self._current_consume_span = None
140140

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

188-
def close(self):
188+
def close(self, *args, **kwargs):
189189
return ConfluentKafkaInstrumentor.wrap_close(
190-
self._consumer.close, self
190+
self._consumer.close, self, args, kwargs
191191
)
192192

193193
def committed(self, partitions, timeout=-1):
@@ -308,8 +308,10 @@ def _inner_wrap_consume(func, instance, args, kwargs):
308308
func, instance, self._tracer, args, kwargs
309309
)
310310

311-
def _inner_wrap_close(func, instance):
312-
return ConfluentKafkaInstrumentor.wrap_close(func, instance)
311+
def _inner_wrap_close(func, instance, args, kwargs):
312+
return ConfluentKafkaInstrumentor.wrap_close(
313+
func, instance, args, kwargs
314+
)
313315

314316
wrapt.wrap_function_wrapper(
315317
AutoInstrumentedProducer,
@@ -421,7 +423,7 @@ def wrap_consume(func, instance, tracer, args, kwargs):
421423
return records
422424

423425
@staticmethod
424-
def wrap_close(func, instance):
426+
def wrap_close(func, instance, args, kwargs):
425427
if instance._current_consume_span:
426428
_end_current_consume_span(instance)
427-
func()
429+
func(*args, **kwargs)

0 commit comments

Comments
 (0)