提交 d460150f 作者: Steven Allen

gateway: label get requests latency with the path namespace

上级 ebd89b40
...@@ -173,7 +173,8 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request ...@@ -173,7 +173,8 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
webError(w, "ipfs cat "+escapedURLPath, err, http.StatusNotFound) webError(w, "ipfs cat "+escapedURLPath, err, http.StatusNotFound)
return return
} }
unixfsGetMetric.Observe(time.Since(begin).Seconds())
unixfsGetMetric.WithLabelValues(parsedPath.Namespace()).Observe(time.Since(begin).Seconds())
defer dr.Close() defer dr.Close()
......
...@@ -98,12 +98,12 @@ var ( ...@@ -98,12 +98,12 @@ var (
prometheus.BuildFQName("ipfs", "p2p", "peers_total"), prometheus.BuildFQName("ipfs", "p2p", "peers_total"),
"Number of connected peers", []string{"transport"}, nil) "Number of connected peers", []string{"transport"}, nil)
unixfsGetMetric = prometheus.NewSummary(prometheus.SummaryOpts{ unixfsGetMetric = prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: "ipfs", Namespace: "ipfs",
Subsystem: "http", Subsystem: "http",
Name: "unixfs_get_latency_seconds", Name: "unixfs_get_latency_seconds",
Help: "The time till the first block is received when 'getting' a file from the gateway.", Help: "The time till the first block is received when 'getting' a file from the gateway.",
}) }, []string{"namespace"})
) )
type IpfsNodeCollector struct { type IpfsNodeCollector struct {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论