1 Star 0 Fork 0

妥協/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
metrics.go 1.89 KB
一键复制 编辑 原始数据 按行查看 历史
Will Lahti 提交于 2018-11-26 16:56 . Instrument deliver service
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package deliver
import (
"github.com/hyperledger/fabric/common/metrics"
)
var (
streamsOpened = metrics.CounterOpts{
Namespace: "deliver",
Name: "streams_opened",
Help: "The number of GRPC streams that have been opened for the deliver service.",
}
streamsClosed = metrics.CounterOpts{
Namespace: "deliver",
Name: "streams_closed",
Help: "The number of GRPC streams that have been closed for the deliver service.",
}
requestsReceived = metrics.CounterOpts{
Namespace: "deliver",
Name: "requests_received",
Help: "The number of deliver requests that have been received.",
LabelNames: []string{"channel", "filtered"},
StatsdFormat: "%{#fqname}.%{channel}.%{filtered}",
}
requestsCompleted = metrics.CounterOpts{
Namespace: "deliver",
Name: "requests_completed",
Help: "The number of deliver requests that have been completed.",
LabelNames: []string{"channel", "filtered", "success"},
StatsdFormat: "%{#fqname}.%{channel}.%{filtered}.%{success}",
}
blocksSent = metrics.CounterOpts{
Namespace: "deliver",
Name: "blocks_sent",
Help: "The number of blocks sent by the deliver service.",
LabelNames: []string{"channel", "filtered"},
StatsdFormat: "%{#fqname}.%{channel}.%{filtered}",
}
)
type Metrics struct {
StreamsOpened metrics.Counter
StreamsClosed metrics.Counter
RequestsReceived metrics.Counter
RequestsCompleted metrics.Counter
BlocksSent metrics.Counter
}
func NewMetrics(p metrics.Provider) *Metrics {
return &Metrics{
StreamsOpened: p.NewCounter(streamsOpened),
StreamsClosed: p.NewCounter(streamsClosed),
RequestsReceived: p.NewCounter(requestsReceived),
RequestsCompleted: p.NewCounter(requestsCompleted),
BlocksSent: p.NewCounter(blocksSent),
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liurenhao/fabric.git
git@gitee.com:liurenhao/fabric.git
liurenhao
fabric
fabric
v1.4.1

搜索帮助

0d507c66 1850385 C8b1a773 1850385