aboutsummaryrefslogtreecommitdiff
path: root/handler.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 13:01:51 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-12-01 13:01:51 +0100
commitf7af98fc6ef283155f94f4294a430d8e792b9a7b (patch)
treec52bc43012d14bd91413739d2d5e992e26c15d0e /handler.go
parent868366cf35e2e649fe7265201d527dbb76bbaf68 (diff)
removed explicit string function
Diffstat (limited to 'handler.go')
-rw-r--r--handler.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/handler.go b/handler.go
index d6d4224..bd1fbdb 100644
--- a/handler.go
+++ b/handler.go
@@ -26,16 +26,16 @@ func (a handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var now time.Time = time.Now()
var statusCode int
defer func() {
- rspcnt.Inc(a.instance.LogParameters.id(), a.endpoint.String(), fmt.Sprintf("%d", statusCode))
- latency.Observe(time.Now().Sub(now).Seconds(), a.instance.LogParameters.id(), a.endpoint.String(), fmt.Sprintf("%d", statusCode))
+ rspcnt.Inc(a.instance.LogParameters.id(), string(a.endpoint), fmt.Sprintf("%d", statusCode))
+ latency.Observe(time.Now().Sub(now).Seconds(), a.instance.LogParameters.id(), string(a.endpoint), fmt.Sprintf("%d", statusCode))
}()
- reqcnt.Inc(a.instance.LogParameters.id(), a.endpoint.String())
+ reqcnt.Inc(a.instance.LogParameters.id(), string(a.endpoint))
ctx, cancel := context.WithDeadline(r.Context(), now.Add(a.instance.Deadline))
defer cancel()
if r.Method != a.method {
- glog.Warningf("%s: got HTTP %s, wanted HTTP %s", a.instance.LogParameters.Prefix+a.endpoint.String(), r.Method, a.method)
+ glog.Warningf("%s/%s: got HTTP %s, wanted HTTP %s", a.instance.LogParameters.Prefix, string(a.endpoint), r.Method, a.method)
a.sendHTTPError(w, http.StatusMethodNotAllowed, fmt.Errorf("method not allowed: %s", r.Method))
return
}