removed instrumenthandler changes

This commit is contained in:
Pushpam Choudhary 2019-12-05 20:17:04 +05:30
parent a82449f44f
commit e9524285b2
5 changed files with 6 additions and 3 deletions

View file

@ -59,7 +59,7 @@ func MakeHTMLAPI(metricsName string, f func(http.ResponseWriter, *http.Request)
} }
} }
return prometheus.InstrumentHandlerDuration(metricsName, http.HandlerFunc(withSpan)) return prometheus.InstrumentHandler(metricsName, http.HandlerFunc(withSpan))
} }
// MakeInternalAPI turns a util.JSONRequestHandler function into an http.Handler. // MakeInternalAPI turns a util.JSONRequestHandler function into an http.Handler.

View file

@ -86,7 +86,7 @@ func (t *Cache) AddTransaction(accessToken, txnID string, res *util.JSONResponse
// This cycles the txnMaps forward, i.e. back map is assigned the front and front is assigned an empty map. // This cycles the txnMaps forward, i.e. back map is assigned the front and front is assigned an empty map.
func cacheCleanService(t *Cache) { func cacheCleanService(t *Cache) {
ticker := time.NewTicker(t.cleanupPeriod) ticker := time.NewTicker(t.cleanupPeriod)
for range ticker { for range ticker.C {
t.Lock() t.Lock()
t.txnsMaps[1] = t.txnsMaps[0] t.txnsMaps[1] = t.txnsMaps[0]
t.txnsMaps[0] = make(txnsMap) t.txnsMaps[0] = make(txnsMap)

1
go.mod
View file

@ -1,6 +1,7 @@
module github.com/matrix-org/dendrite module github.com/matrix-org/dendrite
require ( require (
github.com/PC25/naffka v0.0.0-20191204155648-20998d509638
github.com/Shopify/sarama v1.24.1 github.com/Shopify/sarama v1.24.1
github.com/alecthomas/gometalinter v2.0.2+incompatible github.com/alecthomas/gometalinter v2.0.2+incompatible
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf

2
go.sum
View file

@ -4,6 +4,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us=
github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM=
github.com/PC25/naffka v0.0.0-20191204155648-20998d509638 h1:Fux5vtVHzDykSMh3ngtpAOFq+Lm80+GftBFEFT5KAcU=
github.com/PC25/naffka v0.0.0-20191204155648-20998d509638/go.mod h1:WmZZjPXh+eUtcj7/7qUGy/VnIcLUtjDCmD5C0onZW0I=
github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3 h1:j6BAEHYn1kUyW2j7kY0mOJ/R8A0qWwXpvUAEHGemm/g= github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3 h1:j6BAEHYn1kUyW2j7kY0mOJ/R8A0qWwXpvUAEHGemm/g=
github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v0.0.0-20170127151855-574d3147eee3/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/sarama v1.24.1 h1:svn9vfN3R1Hz21WR2Gj0VW9ehaDGkiOS+VqlIcZOkMI= github.com/Shopify/sarama v1.24.1 h1:svn9vfN3R1Hz21WR2Gj0VW9ehaDGkiOS+VqlIcZOkMI=

View file

@ -83,7 +83,7 @@ func makeDownloadAPI(
activeRemoteRequests *types.ActiveRemoteRequests, activeRemoteRequests *types.ActiveRemoteRequests,
activeThumbnailGeneration *types.ActiveThumbnailGeneration, activeThumbnailGeneration *types.ActiveThumbnailGeneration,
) http.HandlerFunc { ) http.HandlerFunc {
return prometheus.InstrumentHandlerDuration(name, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { return prometheus.InstrumentHandler(name, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
req = util.RequestWithLogging(req) req = util.RequestWithLogging(req)
// Set common headers returned regardless of the outcome of the request // Set common headers returned regardless of the outcome of the request