implement basic support of metrics via mgmt server #35

This commit is contained in:
Umputun
2021-04-20 19:04:12 -05:00
parent bece2938f0
commit 8ea0052228
11 changed files with 892 additions and 6 deletions

View File

@@ -36,6 +36,7 @@ type Http struct { // nolint golint
StdOutEnabled bool
Signature bool
Timeouts Timeouts
Metrics Metrics
}
// Matcher source info (server and route) to the destination url
@@ -46,6 +47,10 @@ type Matcher interface {
Mappers() (mappers []discovery.URLMapper)
}
type Metrics interface {
Middleware(next http.Handler) http.Handler
}
// Timeouts consolidate timeouts for both server and transport
type Timeouts struct {
// server timeouts
@@ -89,7 +94,7 @@ func (h *Http) Run(ctx context.Context) error {
h.signatureHandler(),
h.pingHandler,
h.healthMiddleware,
// R.Headers(h.ProxyHeaders...),
h.Metrics.Middleware,
h.headersHandler(h.ProxyHeaders),
h.accessLogHandler(h.AccessLog),
h.stdoutLogHandler(h.StdOutEnabled, logger.New(logger.Log(log.Default()), logger.Prefix("[INFO]")).Handler),