Skip to content

feat(http/prom): introduce StreamLabel components#4251

Merged
cratelyn merged 3 commits intomainfrom
kate/http-prom.stream-label-components
Nov 5, 2025
Merged

feat(http/prom): introduce StreamLabel components#4251
cratelyn merged 3 commits intomainfrom
kate/http-prom.stream-label-components

Conversation

@cratelyn
Copy link
Member

@cratelyn cratelyn commented Oct 17, 2025

nb: this branch is based upon #4250.

  • feat(http/prom): add http and grpc status labelers
    this commit introduces a collection of MkStreamLabel and StreamLabel
    implementations that can be used to inspect status codes for HTTP and
    gRPC traffic.

    these do not emit duration labels, but can be used by other
    implementors of these traits to perform the common logic of checking
    HTTP status codes in response front matter, and for inspecting body
    trailers in gRPC traffic.

  • feat(http/prom): add an error labeler
    this commit introduces a LabelError<E> type, which provides a
    StreamLabel implementation that maps boxed errors to labels.

    this is generic across E-typed labels that can be constructed From a
    reference to a boxed linkerd_error::Error.

  • feat(http/prom): add an identity labeler

    this commit introduces a simple "identity" implementation of
    MkStreamLabel and StreamLabel.

    this is useful for metrics such as our duration recording histogram,
    that do not inspect the request, response, or outcome for further
    labels.

@cratelyn cratelyn self-assigned this Oct 17, 2025
@cratelyn cratelyn force-pushed the kate/http-prom.stream-label-components branch from aac9f88 to c8d28a6 Compare October 17, 2025 18:51
@cratelyn cratelyn changed the title kate/http prom.stream label components feat(http/prom): introduce StreamLabel components Oct 17, 2025
@cratelyn cratelyn marked this pull request as ready for review October 17, 2025 19:06
@cratelyn cratelyn requested a review from a team as a code owner October 17, 2025 19:06
Base automatically changed from kate/http-prom.label-set-trait-alias to main November 5, 2025 16:06
this commit introduces a collection of `MkStreamLabel` and `StreamLabel`
implementations that can be used to inspect status codes for HTTP and
gRPC traffic.

these do not emit duration labels, but can be used by other
implementors of these traits to perform the common logic of checking
HTTP status codes in response front matter, and for inspecting body
trailers in gRPC traffic.

Signed-off-by: katelyn martin <kate@buoyant.io>
this commit introduces a `LabelError<E>` type, which provides a
`StreamLabel` implementation that maps boxed errors to labels.

this is generic across `E`-typed labels that can be constructed `From` a
reference to a boxed `linkerd_error::Error`.

Signed-off-by: katelyn martin <kate@buoyant.io>
this commit introduces a simple "identity" implementation of
`MkStreamLabel` and `StreamLabel`.

this is useful for metrics such as our duration recording histogram,
that do not inspect the request, response, or outcome for further
labels.

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn cratelyn force-pushed the kate/http-prom.stream-label-components branch from 3683a66 to 771854a Compare November 5, 2025 16:09
@cratelyn cratelyn enabled auto-merge (squash) November 5, 2025 16:10
@cratelyn cratelyn merged commit 6ef1ec8 into main Nov 5, 2025
16 checks passed
@cratelyn cratelyn deleted the kate/http-prom.stream-label-components branch November 5, 2025 16:15
cratelyn added a commit that referenced this pull request Nov 5, 2025
**nb:** this branch is based upon
#4250
and #4251.

this branch re-frames the outbound proxy's stream labeling
facilities in terms of the constituent status and error labeling
facilities introduced to the `linkerd-http-prom` library in
#4251.

* feat(app/outbound): convenience constructors for `HttpRsp`, `GrpcRsp`

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

* feat(app/outbound): `GrpcRsp`, `HttpRsp` are `From<&Error>`

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

* feat(app/outbound): `GrpcRsp` and `HttpRsp` can be merged

this commit introduces `apply()` methods to `HttpRsp` and `GrpcRsp`.
this allows us to collect both the response status and response error
when a body encounters an error whilst polling.

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

* refactor(app/outbound): `LabelHttpRsp` uses `LabelHttpStatus`

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

* refactor(app/outbound): `LabelGrpcRsp` uses `LabelGrpcStatus`

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

---------

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit that referenced this pull request Feb 9, 2026
#4251 introduced a suite of MkStreamLabel
components that can be used to inspect and label traffic. MkWithLabels
offers a way to construct this type externally, now that we will have
use for it in the inbound proxy.

Signed-off-by: katelyn martin <kate@buoyant.io>
cratelyn added a commit that referenced this pull request Feb 10, 2026
#4251 introduced a suite of MkStreamLabel
components that can be used to inspect and label traffic. MkWithLabels
offers a way to construct this type externally, now that we will have
use for it in the inbound proxy.

Signed-off-by: katelyn martin <kate@buoyant.io>
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