Skip to content

Commit

Permalink
gateway: label get requests latency with the path namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Jun 5, 2019
1 parent ebd89b4 commit d460150
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/corehttp/gateway_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
webError(w, "ipfs cat "+escapedURLPath, err, http.StatusNotFound)
return
}
unixfsGetMetric.Observe(time.Since(begin).Seconds())

unixfsGetMetric.WithLabelValues(parsedPath.Namespace()).Observe(time.Since(begin).Seconds())

defer dr.Close()

Expand Down
4 changes: 2 additions & 2 deletions core/corehttp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ var (
prometheus.BuildFQName("ipfs", "p2p", "peers_total"),
"Number of connected peers", []string{"transport"}, nil)

unixfsGetMetric = prometheus.NewSummary(prometheus.SummaryOpts{
unixfsGetMetric = prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: "ipfs",
Subsystem: "http",
Name: "unixfs_get_latency_seconds",
Help: "The time till the first block is received when 'getting' a file from the gateway.",
})
}, []string{"namespace"})
)

type IpfsNodeCollector struct {
Expand Down

0 comments on commit d460150

Please sign in to comment.