File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package main
22
33import (
4- "context"
54 "log/slog"
65 "net/http"
76 "os"
@@ -129,14 +128,9 @@ func main() {
129128 IdleTimeout : 60 * time .Second ,
130129 }
131130
132- << << << < HEAD
133- // Wrap the mux with monitoring and then CORS from v1 router
134- handler := v1Router .ApplyCORS (monitoring .HTTPMetricsMiddleware (mux ))
135- == == == =
136- // Wrap the mux with metrics (outermost) and CORS middleware
131+ // Wrap the mux with metrics (outermost) and then CORS from v1 router
137132 // Metrics must be outermost to capture all requests, including CORS-blocked ones
138- handler := monitoring .HTTPMetricsMiddleware (corsMiddleware (mux ))
139- >> >> >> > 7 f25a11 (connect CE and PDP to observabilit stack )
133+ handler := monitoring .HTTPMetricsMiddleware (v1Router .ApplyCORS (mux ))
140134 httpServer := utils .CreateServer (serverConfig , handler )
141135
142136 // Start server with graceful shutdown
Original file line number Diff line number Diff line change @@ -138,20 +138,18 @@ func normalizeRoute(path string) string {
138138 fullPath := "/" + strings .Join (parts , "/" )
139139
140140 routesMu .RLock ()
141+ defer routesMu .RUnlock ()
141142 // Check exact static routes first (O(1) lookup)
142143 if exactMatch , exists := routes [fullPath ]; exists && exactMatch {
143- routesMu .RUnlock ()
144144 return fullPath
145145 }
146146
147147 // Match against registered templates
148148 for _ , template := range routeTemplates {
149149 if matchesTemplate (fullPath , template , parts ) {
150- routesMu .RUnlock ()
151150 return template
152151 }
153152 }
154- routesMu .RUnlock ()
155153
156154 // Fallback: detect ID patterns for unregistered routes (checks all segments)
157155 if len (parts ) == 1 {
You can’t perform that action at this time.
0 commit comments