Skip to content

Document custom Kafka client metrics on otel.io #4063

Open
@lmolkova

Description

@lmolkova

Context

  • New Kafka metrics design is outlined in KIP-714
  • It's not OTel-compatible and uses different names/attributes/instruments than otel
  • Metrics are intended to be collected by default, serialized to OTLP and sent to broker from which they can be collected by users - impl in java

Effectively, Kafka project does not plan to follow OTel semconv (@AndrewJSchofield to confirm)

OTel provides several kafka instrumentation components:

  1. Some of them are based on monkey-patching/byte-code rewriting and can emit otel-compatible metrics and traces
  2. Others (such as collector kafkareceiver or .NET Aspire Kafka integration library) scrape metrics that broker provide

The problem:

Group 1 (monkey-patched instrumentations) might still want to emit kafka-specific metrics/traces. We'll need to keep them in otel-semconv repo so they are consistent across languages/clients.

Group 2 (instrumentations that report what's available) have more difficult problems:
There are multiple ways to scrape different sets of metrics from Kafka:

  1. Java uses Kafka JMX metrics
  2. collector uses Kafka client library APIs to get stats
  3. .NET Aspire component uses metrics available through underlying librdkafka
  4. Once KIP-714 is implemented in different langauges, there will be yet another way

These metrics in most cases can't be converted to OTel ones (use different instruments, don't support histograms, don't report the same attributes, etc).

As a result, we're going to end up with each language SIG (plus external components) defining their own set of custom metrics for Kafka based on what they have.

What we can do on otel semconv side:

  • recommend a default way to scrape metrics from kafka
  • recommend naming approach (e.g. Java and collector start with kafka and not messaging.kafka as we do in OTel semconv)
  • provide a single place to list all existing non-otel-compatible kafka-related metrics (e.g. docs in opentelemetry.io) similar to JMX, but for all languages

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions