Skip to main content

extract_grpc_method_name

Function extract_grpc_method_name 

Source
pub fn extract_grpc_method_name(path: &str) -> &str
Expand description

Extracts the gRPC method name from a request URI path.

gRPC paths follow the HTTP/2 form "/" Service-Name "/" {method name}, where Service-Name is {proto package} "." {service name} and the method name is a single proto identifier. Anything that does not match this exact shape — health probes, browser requests, bot scans probing for .env files, etc. — is mapped to "non_grpc" so the value is safe to use as a Prometheus label without blowing up cardinality or label-value length.