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:
Alex Ellis (VMware)
2019-01-05 10:17:18 +00:00
committed by Alex Ellis
parent 5a1bdcdb91
commit fca32a0e79
5 changed files with 31 additions and 11 deletions

View File

@ -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{})