open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.72k stars 2.15k forks source link

[receiver/kafkametrics] Kafka consumer offset gives a random value instead of an actual offset #33309

Open an-mmx opened 1 month ago

an-mmx commented 1 month ago

Component(s)

receiver/kafkametrics

What happened?

Description

It seems there is an issue in the code: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/kafkametricsreceiver/consumer_scraper.go#L145

For the consumer offset (RecordKafkaConsumerGroupOffsetDataPoint) it should send consumerOffset instead of offsetSum.

Steps to Reproduce

0) Precondition: having Kafka topic with more than 1 partition. 1) Run the receiver, use debug output. 2) Compare Kafka consumer offset metrics with actual in the Kafka ui.

Expected Result

The Kafka consumer offset represent actual consumer offset value

Actual Result

We can see that consumer offset value doesn't match with the actual value from Kafka ui.

Collector version

v0.101.0

Environment information

Environment

Any

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

github-actions[bot] commented 1 month ago

Pinging code owners: