Skip to content

KIP-714 & KIP-1106 - #988

Merged
twmb merged 11 commits into
masterfrom
kip714
Apr 29, 2025
Merged

KIP-714 & KIP-1106#988
twmb merged 11 commits into
masterfrom
kip714

Conversation

@twmb

@twmb twmb commented Apr 28, 2025

Copy link
Copy Markdown
Owner

This supports 12 of the recommended 21 metrics; all 6 of the required ones.

KIP-1106 is supported by adding a client option, UserMetricsFn, allowing you to provide user metrics at every metric aggregation interval. Client metrics can be disabled with DisableClientMetrics. UserMetricsFn returns an iter.Seq[Metric], requiring the minimum Go version for franz-go to be bumped to 1.23.

The compression API was simplified (hopefully) a bit by now not leaking an internal implementation detail.

This has been manually tested in two ways,

  • Actual serialization was printed to a file and then validated with protoc.

This was done with:

git clone git@github.com:open-telemetry/opentelemetry-proto

protoc --proto_path=./opentelemetry-proto \
       --decode opentelemetry.proto.metrics.v1.MetricsData \
       ./opentelemetry-proto/opentelemetry/proto/metrics/v1/metrics.proto \
       < SERIALIZED

I did not test viewing the metrics at the end, since I don't want to further figure out how to set up 3rd party systems. It would be beneficial for Confluent to provide a KIP-714 enabled broker and local server / log message to check correctness, but alas, a lot of KIP-714 leaves it for the implementor to figure out 👍 .

Unit tests are gated on introducing more third party libraries, which I'd like to avoid.

Closes #848.

twmb added 6 commits April 28, 2025 12:35
Required for incoming feature using iter.Seq
Compress should not expose the internals of what produce request version
is being used during compression. Instead, we replace this with compress
flags which can be extended in the future if needed. The current only
compress flag is disable gzip.

This allows the compressor to be used in other areas of the code
unrelated to producing.

The dst bytes.Buffer is a bit annoying if used outside of produce but eh
it's easy enough to just throw a new(bytes.Buffer) at it, if we do not
want to worry about the bytes.Buffer pooling.

Uint32 flags should hopefully be enough; since the implementation will
be in user hands, I don't want to go overboard on some opaque struct
with complex behavior.
This adds a code to the few places needed to observe required (and a
_few_ optional) client metrics.

Some metrics were removed in this commit; the rebalance latency is
underspecified, the fetch latency seems to duplicate consumer node
request latency, and assigned partitions seems like medium signal and is
tedious to work in. Thus, we are left with 12 metrics, 6 of which are
required, of the 21 recommended metrics in the KIP. That's a fine start
and we can stick with it unless requested.
twmb added 5 commits April 28, 2025 17:00
* If no requested metrics, sleep for the push interval and re-get
* Handle (hopefully) new error with KIP-848
* Actually init the metrics so we do not panic immediately!
This commit fixes a few things after actually testing against a Kafka
docker-compose that actually has metrics collection enabled. Notably,

* All metrics need to be prefixed with `org.apache.kafka.`
* Fixes the switch type case match -- we could elide the & above, but
  for consistency above, we keep it
* Fixes the encoding of NumberDataPoint.value.as_int, which is a
  sfixed64 not an int.

I validated the serialization of a serialized payload by writing it to a
file and checking it against protoc; after these changes, it
deserializes correctly.
@twmb twmb changed the title Kip714 Apr 29, 2025
@twmb
twmb merged commit db5a032 into master Apr 29, 2025
@twmb
twmb deleted the kip714 branch April 29, 2025 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant