Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(prom): Remove MkStreamLabel's associated types #3234

Closed
wants to merge 1 commit into from

Commits on Sep 25, 2024

  1. refactor(prom): Remove MkStreamLabel's associated types (#3234)

    `MkStreamLabel` is, in short, a generic
    `(&Request) -> Option<StreamLabel>` function. we use it to inspect a
    request, and potentially provide the caller with an object that can
    provide relevant labels.
    
    the `StreamLabel` interface includes associated types for the labels
    used for metrics related to request/response duration, and counting
    status codes.
    
    we do not however, actually need to separately define these associated
    types in the `MkStreamLabel` contract. instead, we can return a generic
    `StreamLabel` of some sort, and leave the responsibility of the
    (admittedly baroque) associated type access to our type aliases
    like `RecordResponseDuration` and `RecordRequestDuration`.
    
    this change has a pleasant knock-on effect of leaving a number of the
    labels submodule's type aliases unused. this commit accordingly removes
    aliases like `HttpRouteRsp`, `GrpcRouteRsp`, `HttpRouteBackendRsp`, and
    `GrpcRouteBackendRsp`.
    
    this is a small initial step towards simplifying code that must interact
    with the `MkStreamLabel` interface.
    
    Signed-off-by: katelyn martin <[email protected]>
    cratelyn committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    ca8c3fb View commit details
    Browse the repository at this point in the history