Refactor diagnostics -> telemetry

This commit is contained in:
Matthew Holt
2018-03-22 18:05:31 -06:00
parent 7c868afd32
commit 52316952a5
16 changed files with 96 additions and 97 deletions

View File

@@ -36,7 +36,7 @@ import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/mholt/caddy/caddytls"
"github.com/mholt/caddy/diagnostics"
"github.com/mholt/caddy/telemetry"
)
// Server is the HTTP server implementation.
@@ -347,8 +347,8 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}()
// TODO: Somehow report UA string in conjunction with TLS handshake, if any (and just once per connection)
go diagnostics.AppendUnique("http_user_agent", r.Header.Get("User-Agent"))
go diagnostics.Increment("http_request_count")
go telemetry.AppendUnique("http_user_agent", r.Header.Get("User-Agent"))
go telemetry.Increment("http_request_count")
// copy the original, unchanged URL into the context
// so it can be referenced by middlewares