MCPcopy Index your code
hub / github.com/modelcontextprotocol/registry / getRoutePath

Function getRoutePath

internal/api/router/router.go:38–46  ·  view source on GitHub ↗

getRoutePath extracts the route pattern from the context

(ctx huma.Context)

Source from the content-addressed store, hash-verified

36
37// getRoutePath extracts the route pattern from the context
38func 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
48func MetricTelemetryMiddleware(metrics *telemetry.Metrics, options ...MiddlewareOption) func(huma.Context, func(huma.Context)) {
49 config := &middlewareConfig{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…