Skip to content

Conversation

@cratelyn
Copy link
Member

we apply a collection of Layers to an inner service in our metrics
subsystem. doing so with layer::mk() and Layer::layer() is somewhat
ungainly.

this commit relies on svc::layers() to apply a sequence of telemetry
layers in sequence.

this should have no mechanical difference with the preëxisting code.

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

we apply a collection of `Layers` to an inner service in our metrics
subsystem. doing so with `layer::mk()` and `Layer::layer()` is somewhat
ungainly.

this commit relies on `svc::layers()` to apply a sequence of telemetry
layers in sequence.

this should have no mechanical difference with the preëxisting code.

Signed-off-by: katelyn martin <kate@buoyant.io>
@cratelyn cratelyn self-assigned this Sep 24, 2025
@cratelyn cratelyn marked this pull request as ready for review September 24, 2025 15:45
@cratelyn cratelyn requested a review from a team as a code owner September 24, 2025 15:45
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.

not a hard blocker, but two recommendations

NewResponseDuration<T, ExtractRecordDurationParams<ResponseMetrics<T::StreamLabel>>, N>,
>,
>,
> + Clone
Copy link
Member

Choose a reason for hiding this comment

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

it's generally good for our layers to be clone, it would preferable to preserve this

Copy link
Member Author

Choose a reason for hiding this comment

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

i have not found a clear way to preserve this. i'm rather surprised by this, as i don't see any clear reason why this shouldn't be Clone. i tried wrapping the layer in a svc::layer::mk() call, with and without a call to into_inner() (below), but that didn't seem to work either!

i'd normally put this down, but the layers().push().push() syntax feels nice enough that i'm curious what's standing in the way here.

svc::layers()
.push(duration)
.push(count_reqs)
.push(body_data)
Copy link
Member

Choose a reason for hiding this comment

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

I think you can do an into_inner() to drop the Layers type wrapper...

Copy link
Member Author

Choose a reason for hiding this comment

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

i opened #4192, which introduces an into_inner() method.

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.

4 participants