Skip to content

Getting payload size in a tower::Layer #2469

@ranger-ross

Description

@ranger-ross

I am trying to create a Layer that tracks metrics for my gRPC service.
I'd like to follow the OTEL semantic conventions for RPC.

I having trouble implementing rpc.server.request.size as I can't seem to find a way to get the size of the message we send over the wire.

I came across fn size_hint() on body but from what I can tell its only implemented for streams? (from my testing its always SizeHint { lower: 0, upper: None })

Is there any way to get the payload size from a Layer middleware?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions