Skip to content

Conversation

@cratelyn
Copy link
Member

in #4180, we noted during review that encoding
prometheus labels for route and parent metadata entails a slightly
unfortunate amount of repetitive boilerplate.

in the outbound proxy, we define a local RouteLabels type that
implements the EncodeLabelSet and EncodeLabelSetMut, which we use to
integrate label sets with the prometheus_client SDK.

this commit introduces an equivalent pattern to the inbound proxy. a
RouteLabels newtype wrapper over the shared linkerd_app_core
structure is introduced, which in turn simplifies the EncodeLabelSet
and EncodeLabelSetMut implementations of the RequestCountLabels,
ResponseBodyDataLabels, and RequestBodyDataLabels types.

Signed-off-by: katelyn martin [email protected]

in #4180, we noted during review that encoding
prometheus labels for route and parent metadata entails a slightly
unfortunate amount of repetitive boilerplate.

in the outbound proxy, we define a local `RouteLabels` type that
implements the `EncodeLabelSet` and `EncodeLabelSetMut`, which we use to
integrate label sets with the `prometheus_client` SDK.

this commit introduces an equivalent pattern to the inbound proxy. a
`RouteLabels` newtype wrapper over the shared `linkerd_app_core`
structure is introduced, which in turn simplifies the `EncodeLabelSet`
and `EncodeLabelSetMut` implementations of the `RequestCountLabels`,
`ResponseBodyDataLabels`, and `RequestBodyDataLabels` types.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn cratelyn self-assigned this Sep 26, 2025
@cratelyn cratelyn marked this pull request as ready for review September 26, 2025 20:39
@cratelyn cratelyn requested a review from a team as a code owner September 26, 2025 20:39
Copy link
Member

@olix0r olix0r left a comment

Choose a reason for hiding this comment

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

love it

@cratelyn cratelyn merged commit ee25d12 into main Sep 29, 2025
15 checks passed
@cratelyn cratelyn deleted the kate/app-inbound.dry-up-route-labels-encoding branch September 29, 2025 17:18
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.

3 participants