mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Instrument async handlers
- instruments async handler for report and for queueing async requests - make MustRegister only ever run once to prevent sync issues Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
5a1bdcdb91
commit
fca32a0e79
@ -96,7 +96,10 @@ func main() {
|
||||
faasHandlers.SecretHandler = handlers.MakeForwardingProxyHandler(reverseProxy, forwardingNotifiers, urlResolver, nilURLTransformer)
|
||||
|
||||
alertHandler := plugin.NewExternalServiceQuery(*config.FunctionsProviderURL, credentials)
|
||||
faasHandlers.Alert = handlers.MakeNotifierWrapper(handlers.MakeAlertHandler(alertHandler), forwardingNotifiers)
|
||||
faasHandlers.Alert = handlers.MakeNotifierWrapper(
|
||||
handlers.MakeAlertHandler(alertHandler),
|
||||
forwardingNotifiers,
|
||||
)
|
||||
|
||||
if config.UseNATS() {
|
||||
log.Println("Async enabled: Using NATS Streaming.")
|
||||
@ -105,8 +108,15 @@ func main() {
|
||||
log.Fatalln(queueErr)
|
||||
}
|
||||
|
||||
faasHandlers.QueuedProxy = handlers.MakeCallIDMiddleware(handlers.MakeQueuedProxy(metricsOptions, true, natsQueue, functionURLTransformer))
|
||||
faasHandlers.AsyncReport = handlers.MakeAsyncReport(metricsOptions)
|
||||
faasHandlers.QueuedProxy = handlers.MakeNotifierWrapper(
|
||||
handlers.MakeCallIDMiddleware(handlers.MakeQueuedProxy(metricsOptions, true, natsQueue, functionURLTransformer)),
|
||||
forwardingNotifiers,
|
||||
)
|
||||
|
||||
faasHandlers.AsyncReport = handlers.MakeNotifierWrapper(
|
||||
handlers.MakeAsyncReport(metricsOptions),
|
||||
forwardingNotifiers,
|
||||
)
|
||||
}
|
||||
|
||||
prometheusQuery := metrics.NewPrometheusQuery(config.PrometheusHost, config.PrometheusPort, &http.Client{})
|
||||
|
Reference in New Issue
Block a user