Skip to content

refactor(app/core): remove EncodeLabelSetMut - #4588

Merged
cratelyn merged 1 commit into
mainfrom
kate/remove-encode-label-set-mut-trait
Jul 10, 2026
Merged

cratelyn merged 1 commit into
mainfrom
kate/remove-encode-label-set-mut-trait

Conversation

@cratelyn

@cratelyn cratelyn commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

in #4587, we upgraded our dependency upon kubert
to a new 0.26.0 release. as part of this, our dependency upon the
prometheus sdk was also upgraded from 0.23 to 0.24.

version 0.24.0 included some exciting upstream changes that we drove
last year, particularly prometheus/client_rust#257. from that pr:

[this pr] alters the signature of the EncodeLabelSet::encode()
trait method, such that it now accepts a mutable reference to its
encoder.

this change permits distinct label sets to be composed together, now
that the label set encoder is not consumed. a new implementation for
tuples (A, B) is provided.

we'd been working around this deficiency using an internal trait that
did provide our desired trait signature, originally introduced in
#2555.

https://github.com/linkerd/linkerd2-proxy/pull/2555/changes#diff-36a73a9a9de1e34abac85003560b0aea70e9ebb0f1cc29af3dce703bfbef7a89R47-R49

now that we've upgraded to a more recent prometheus_client version,
this trait is no longer needed, and all of the glue connecting
EncodeLabelSet to our applicative labels via EncodeLabelSetMut can
be removed.

no code is changed. function bodies are moved from
linkerd_app_core::metrics::prom::EncodeLabelSetMut::encode_label_set()
to prometheus_client::encoding::EncodeLabelSet::encode(). invocations
of the former are replaced with the latter where applicable.

Signed-off-by: katelyn martin kate@buoyant.io

in #4587, we upgraded our dependency upon kubert
to a new 0.26.0 release. as part of this, our dependency upon the
prometheus sdk was also upgraded from 0.23 to 0.24.

version 0.24.0 included some exciting upstream changes that we drove
last year, particularly prometheus/client_rust#257. from that pr:

> [this pr] alters the signature of the `EncodeLabelSet::encode()`
> trait method, such that it now accepts a mutable reference to its
> encoder.
>
> this change permits distinct label sets to be composed together, now
> that the label set encoder is not consumed. a new implementation for
> tuples `(A, B)` is provided.

we'd been working around this deficiency using an internal trait that
_did_ provide our desired trait signature, originally introduced in
#2555.

https://github.com/linkerd/linkerd2-proxy/pull/2555/changes#diff-36a73a9a9de1e34abac85003560b0aea70e9ebb0f1cc29af3dce703bfbef7a89R47-R49

now that we've upgraded to a more recent `prometheus_client` version,
this trait is no longer needed, and all of the glue connecting
`EncodeLabelSet` to our applicative labels via `EncodeLabelSetMut` can
be removed.

no code is changed. function bodies are moved from
`linkerd_app_core::metrics::prom::EncodeLabelSetMut::encode_label_set()`
to `prometheus_client::encoding::EncodeLabelSet::encode()`. invocations
of the former are replaced with the latter where applicable.

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn cratelyn self-assigned this Jul 9, 2026
@cratelyn
cratelyn marked this pull request as ready for review July 9, 2026 16:41
@cratelyn
cratelyn requested a review from a team as a code owner July 9, 2026 16:41
@cratelyn
cratelyn requested a review from zaharidichev July 9, 2026 16:42

@zaharidichev zaharidichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great simplification! Was not aware this is in the works. 🎉

@cratelyn
cratelyn merged commit f4a9514 into main Jul 10, 2026
14 of 15 checks passed
@cratelyn
cratelyn deleted the kate/remove-encode-label-set-mut-trait branch July 10, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants