mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-07 09:17:49 +08:00
Merge pull request #6406 from ipfs/feat/gateway-metric
add unixfs get metric
This commit is contained in:
commit
1fd5f9d4bc
@ -123,6 +123,7 @@ func (i *gatewayHandler) optionsHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request) {
|
||||
begin := time.Now()
|
||||
urlPath := r.URL.Path
|
||||
escapedURLPath := r.URL.EscapedPath()
|
||||
|
||||
@ -173,6 +174,8 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
|
||||
unixfsGetMetric.WithLabelValues(parsedPath.Namespace()).Observe(time.Since(begin).Seconds())
|
||||
|
||||
defer dr.Close()
|
||||
|
||||
// Check etag send back to us
|
||||
|
||||
@ -97,6 +97,13 @@ var (
|
||||
peersTotalMetric = prometheus.NewDesc(
|
||||
prometheus.BuildFQName("ipfs", "p2p", "peers_total"),
|
||||
"Number of connected peers", []string{"transport"}, nil)
|
||||
|
||||
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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user