Skip to content

Commit af8ba3f

Browse files
committed
Fix merge conflict + Address PR Comment
1 parent 5ef5bc2 commit af8ba3f

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

exchange/consent-engine/main.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
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-
>>>>>>> 7f25a11 (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

exchange/shared/monitoring/metrics.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)