implement grpc gateway and addl handler support

This commit is contained in:
2025-03-24 16:24:03 -04:00
parent 4e014d5ea0
commit 262f6a4232
12 changed files with 241 additions and 165 deletions

View File

@ -57,6 +57,15 @@ func prepHTTPServer(opts *opts.AppHTTP) *http.Server {
Msg("mounted prometheus metrics endpoint")
}
// Inject extra handlers if given
// Used for grpc-gateway runtime.ServeMux handlers
for _, h := range opts.Handlers {
if h.StripPrefix {
h.Handler = http.StripPrefix(h.Prefix, h.Handler)
}
mux.Handle(h.Prefix, h.Handler)
}
// Add OTEL, skip health-check spans
// NOTE: Add any other span exclusions here
handler := otelhttp.NewHandler(mux, "/",