1 Star 0 Fork 0

13683679291/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
metrics.go 3.01 KB
一键复制 编辑 原始数据 按行查看 历史
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package chaincode
import "github.com/hyperledger/fabric/common/metrics"
var (
launchDuration = metrics.HistogramOpts{
Namespace: "chaincode",
Name: "launch_duration",
Help: "The time to launch a chaincode.",
LabelNames: []string{"chaincode", "success"},
StatsdFormat: "%{#fqname}.%{chaincode}.%{success}",
}
launchFailures = metrics.CounterOpts{
Namespace: "chaincode",
Name: "launch_failures",
Help: "The number of chaincode launches that have failed.",
LabelNames: []string{"chaincode"},
StatsdFormat: "%{#fqname}.%{chaincode}",
}
launchTimeouts = metrics.CounterOpts{
Namespace: "chaincode",
Name: "launch_timeouts",
Help: "The number of chaincode launches that have timed out.",
LabelNames: []string{"chaincode"},
StatsdFormat: "%{#fqname}.%{chaincode}",
}
shimRequestsReceived = metrics.CounterOpts{
Namespace: "chaincode",
Name: "shim_requests_received",
Help: "The number of chaincode shim requests received.",
LabelNames: []string{"type", "channel", "chaincode"},
StatsdFormat: "%{#fqname}.%{type}.%{channel}.%{chaincode}",
}
shimRequestsCompleted = metrics.CounterOpts{
Namespace: "chaincode",
Name: "shim_requests_completed",
Help: "The number of chaincode shim requests completed.",
LabelNames: []string{"type", "channel", "chaincode", "success"},
StatsdFormat: "%{#fqname}.%{type}.%{channel}.%{chaincode}.%{success}",
}
shimRequestDuration = metrics.HistogramOpts{
Namespace: "chaincode",
Name: "shim_request_duration",
Help: "The time to complete chaincode shim requests.",
LabelNames: []string{"type", "channel", "chaincode", "success"},
StatsdFormat: "%{#fqname}.%{type}.%{channel}.%{chaincode}.%{success}",
}
executeTimeouts = metrics.CounterOpts{
Namespace: "chaincode",
Name: "execute_timeouts",
Help: "The number of chaincode executions (Init or Invoke) that have timed out.",
LabelNames: []string{"chaincode"},
StatsdFormat: "%{#fqname}.%{chaincode}",
}
)
type HandlerMetrics struct {
ShimRequestsReceived metrics.Counter
ShimRequestsCompleted metrics.Counter
ShimRequestDuration metrics.Histogram
ExecuteTimeouts metrics.Counter
}
func NewHandlerMetrics(p metrics.Provider) *HandlerMetrics {
return &HandlerMetrics{
ShimRequestsReceived: p.NewCounter(shimRequestsReceived),
ShimRequestsCompleted: p.NewCounter(shimRequestsCompleted),
ShimRequestDuration: p.NewHistogram(shimRequestDuration),
ExecuteTimeouts: p.NewCounter(executeTimeouts),
}
}
type LaunchMetrics struct {
LaunchDuration metrics.Histogram
LaunchFailures metrics.Counter
LaunchTimeouts metrics.Counter
}
func NewLaunchMetrics(p metrics.Provider) *LaunchMetrics {
return &LaunchMetrics{
LaunchDuration: p.NewHistogram(launchDuration),
LaunchFailures: p.NewCounter(launchFailures),
LaunchTimeouts: p.NewCounter(launchTimeouts),
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mmcro/fabric.git
git@gitee.com:mmcro/fabric.git
mmcro
fabric
fabric
v2.1.1

搜索帮助

0d507c66 1850385 C8b1a773 1850385