OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / api / metrics.go
diff --git a/api/metrics.go b/api/metrics.go
deleted file mode 100644 (file)
index 4e95b52..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package api
-
-import (
-       "net/http"
-       "sync"
-       "time"
-
-       "github.com/vapor/metrics"
-)
-
-var (
-       latencyMu sync.Mutex
-       latencies = map[string]*metrics.RotatingLatency{}
-)
-
-// latency returns a rotating latency histogram for the given request.
-func latency(tab *http.ServeMux, req *http.Request) *metrics.RotatingLatency {
-       latencyMu.Lock()
-       defer latencyMu.Unlock()
-       if l := latencies[req.URL.Path]; l != nil {
-               return l
-       }
-       // Create a histogram only if the path is legit.
-       if _, pat := tab.Handler(req); pat == req.URL.Path {
-               d := 100 * time.Millisecond
-               l := metrics.NewRotatingLatency(5, d)
-               latencies[req.URL.Path] = l
-               metrics.PublishLatency(req.URL.Path, l)
-               return l
-       }
-       return nil
-}