Standardize twirp hooks during server init (#2959)

This commit is contained in:
David Zhao
2024-08-26 00:53:13 -07:00
committed by GitHub
parent e9f26c21e7
commit 91cb4369ef
3 changed files with 73 additions and 12 deletions
+11 -12
View File
@@ -107,18 +107,17 @@ func NewLivekitServer(conf *config.Config,
middlewares = append(middlewares, NewAPIKeyAuthMiddleware(keyProvider))
}
twirpLoggingHook := TwirpLogger()
twirpRequestStatusHook := TwirpRequestStatusReporter()
roomServer := livekit.NewRoomServiceServer(roomService, twirpLoggingHook)
agentDispatchServer := livekit.NewAgentDispatchServiceServer(agentDispatchService, twirpLoggingHook)
egressServer := livekit.NewEgressServer(egressService, twirp.WithServerHooks(
twirp.ChainHooks(
twirpLoggingHook,
twirpRequestStatusHook,
),
))
ingressServer := livekit.NewIngressServer(ingressService, twirpLoggingHook)
sipServer := livekit.NewSIPServer(sipService, twirpLoggingHook)
serverOptions := []interface{}{
twirp.WithServerHooks(twirp.ChainHooks(
TwirpLogger(),
TwirpRequestStatusReporter(),
)),
}
roomServer := livekit.NewRoomServiceServer(roomService, serverOptions...)
agentDispatchServer := livekit.NewAgentDispatchServiceServer(agentDispatchService, serverOptions...)
egressServer := livekit.NewEgressServer(egressService, serverOptions...)
ingressServer := livekit.NewIngressServer(ingressService, serverOptions...)
sipServer := livekit.NewSIPServer(sipService, serverOptions...)
mux := http.NewServeMux()
if conf.Development {