serverNameFromContext extracts the current server name from the context. Returns "UNKNOWN" if none is available (should probably never happen).
(ctx context.Context)
| 287 | // serverNameFromContext extracts the current server name from the context. |
| 288 | // Returns "UNKNOWN" if none is available (should probably never happen). |
| 289 | func serverNameFromContext(ctx context.Context) string { |
| 290 | srv, ok := ctx.Value(ServerCtxKey).(*Server) |
| 291 | if !ok || srv == nil || srv.name == "" { |
| 292 | return "UNKNOWN" |
| 293 | } |
| 294 | return srv.name |
| 295 | } |
| 296 | |
| 297 | // metricsInstrumentedRoute wraps a compiled route Handler with metrics |
| 298 | // instrumentation. It wraps the entire compiled route chain once, |