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

@ -50,6 +50,15 @@ func (a *appGRPCServer) prepGRPCServer(spanCtx context.Context) error {
a.registerGRPCServices(ctx)
span.SetAttributes(attribute.Int("grpc.server.grpcservices", len(a.opts.Services)))
// If a grpc-gateway mux was created, store it in opts
// so it can be used by AppHTTP
if a.gatewayMux != nil {
a.opts.SetGatewayMux(a.gatewayMux)
span.SetAttributes(attribute.Bool("grpc.server.grpcgateway.enabled", true))
} else {
span.SetAttributes(attribute.Bool("grpc.server.grpcgateway.enabled", false))
}
// Enable reflection if desired
if a.opts.EnableReflection {
reflection.Register(a.server)