1 Star 0 Fork 0

妥協/fabric

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
metrics.go 839 Bytes
一键复制 编辑 原始数据 按行查看 历史
Will Lahti 提交于 2018-12-11 15:38 . Add meter with fabric and go version
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package operations
import (
"sync"
"github.com/hyperledger/fabric/common/metrics"
"github.com/hyperledger/fabric/common/metrics/prometheus"
)
var (
fabricVersion = metrics.GaugeOpts{
Name: "fabric_version",
Help: "The active version of Fabric.",
LabelNames: []string{"version"},
StatsdFormat: "%{#fqname}.%{version}",
}
gaugeLock sync.Mutex
promVersionGauge metrics.Gauge
)
func versionGauge(provider metrics.Provider) metrics.Gauge {
switch provider.(type) {
case *prometheus.Provider:
gaugeLock.Lock()
defer gaugeLock.Unlock()
if promVersionGauge == nil {
promVersionGauge = provider.NewGauge(fabricVersion)
}
return promVersionGauge
default:
return provider.NewGauge(fabricVersion)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liurenhao/fabric.git
git@gitee.com:liurenhao/fabric.git
liurenhao
fabric
fabric
v1.4.12

搜索帮助