getRoutePath extracts the route pattern from the context
(ctx huma.Context)
| 36 | |
| 37 | // getRoutePath extracts the route pattern from the context |
| 38 | func getRoutePath(ctx huma.Context) string { |
| 39 | // Try to get the operation from context |
| 40 | if op := ctx.Operation().Path; op != "" { |
| 41 | return ctx.Operation().Path |
| 42 | } |
| 43 | |
| 44 | // Fallback to URL path (less ideal for metrics as it includes path parameters) |
| 45 | return ctx.URL().Path |
| 46 | } |
| 47 | |
| 48 | func MetricTelemetryMiddleware(metrics *telemetry.Metrics, options ...MiddlewareOption) func(huma.Context, func(huma.Context)) { |
| 49 | config := &middlewareConfig{ |
no outgoing calls
no test coverage detected
searching dependent graphs…