diff --git a/internal/api/grpc/server/gateway.go b/internal/api/grpc/server/gateway.go index 43947917a2..ca7579ee89 100644 --- a/internal/api/grpc/server/gateway.go +++ b/internal/api/grpc/server/gateway.go @@ -28,6 +28,7 @@ import ( const ( mimeWildcard = "*/*" + UnknownPath = "UNKNOWN_PATH" ) var ( @@ -274,7 +275,11 @@ func grpcCredentials(tlsConfig *tls.Config) credentials.TransportCredentials { func setRequestURIPattern(ctx context.Context) { pattern, ok := runtime.HTTPPathPattern(ctx) if !ok { - return + // As all unmatched paths will be handled by the gateway, any request not matching a pattern, + // means there's no route to the path. + // To prevent high cardinality on metrics and tracing, we want to make sure we don't record + // the actual path as name (it will still be recorded explicitly in the span http info). + pattern = UnknownPath } span := trace.SpanFromContext(ctx) span.SetName(pattern)