當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Registry.Gauge方法代碼示例

本文整理匯總了Golang中github.com/cockroachdb/cockroach/util/metric.Registry.Gauge方法的典型用法代碼示例。如果您正苦於以下問題:Golang Registry.Gauge方法的具體用法?Golang Registry.Gauge怎麽用?Golang Registry.Gauge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cockroachdb/cockroach/util/metric.Registry的用法示例。


在下文中一共展示了Registry.Gauge方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: New

// New creates an instance of a gossip node.
func New(rpcContext *rpc.Context, grpcServer *grpc.Server, resolvers []resolver.Resolver, stopper *stop.Stopper, registry *metric.Registry) *Gossip {
	g := &Gossip{
		Connected:         make(chan struct{}),
		rpcContext:        rpcContext,
		server:            newServer(stopper, registry),
		outgoing:          makeNodeSet(minPeers, registry.Gauge(ConnectionsOutgoingGaugeName)),
		bootstrapping:     map[string]struct{}{},
		disconnected:      make(chan *client, 10),
		stalledCh:         make(chan struct{}, 1),
		stallInterval:     defaultStallInterval,
		bootstrapInterval: defaultBootstrapInterval,
		cullInterval:      defaultCullInterval,
		nodeDescs:         map[roachpb.NodeID]*roachpb.NodeDescriptor{},
		resolverAddrs:     map[util.UnresolvedAddr]resolver.Resolver{},
		bootstrapAddrs:    map[util.UnresolvedAddr]struct{}{},
	}
	g.SetResolvers(resolvers)

	// Add ourselves as a SystemConfig watcher.
	g.is.registerCallback(KeySystemConfig, g.updateSystemConfig)
	// Add ourselves as a node descriptor watcher.
	g.is.registerCallback(MakePrefixPattern(KeyNodeIDPrefix), g.updateNodeAddress)

	RegisterGossipServer(grpcServer, g.server)

	return g
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:28,代碼來源:gossip.go

示例2: newServer

// newServer creates and returns a server struct.
func newServer(stopper *stop.Stopper, registry *metric.Registry) *server {
	return &server{
		stopper:       stopper,
		is:            newInfoStore(0, util.UnresolvedAddr{}, stopper),
		incoming:      makeNodeSet(minPeers, registry.Gauge(ConnectionsIncomingGaugeName)),
		nodeMap:       make(map[util.UnresolvedAddr]serverInfo),
		tighten:       make(chan roachpb.NodeID, 1),
		ready:         make(chan struct{}),
		nodeMetrics:   makeMetrics(registry),
		serverMetrics: makeMetrics(metric.NewRegistry()),
	}
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:13,代碼來源:server.go

示例3: MakeRuntimeStatSampler

// MakeRuntimeStatSampler constructs a new RuntimeStatSampler object.
func MakeRuntimeStatSampler(clock *hlc.Clock, reg *metric.Registry) RuntimeStatSampler {
	return RuntimeStatSampler{
		registry:       reg,
		clock:          clock,
		cgoCalls:       reg.Gauge(nameCgoCalls),
		goroutines:     reg.Gauge(nameGoroutines),
		goAllocBytes:   reg.Gauge(nameGoAllocBytes),
		goTotalBytes:   reg.Gauge(nameGoTotalBytes),
		cgoAllocBytes:  reg.Gauge(nameCgoAllocBytes),
		cgoTotalBytes:  reg.Gauge(nameCgoTotalBytes),
		gcCount:        reg.Gauge(nameGCCount),
		gcPauseNS:      reg.Gauge(nameGCPauseNS),
		gcPausePercent: reg.GaugeFloat64(nameGCPausePercent),
		cpuUserNS:      reg.Gauge(nameCPUUserNS),
		cpuUserPercent: reg.GaugeFloat64(nameCPUUserPercent),
		cpuSysNS:       reg.Gauge(nameCPUSysNS),
		cpuSysPercent:  reg.GaugeFloat64(nameCPUSysPercent),
		rss:            reg.Gauge(nameRSS),
	}
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:21,代碼來源:runtime.go


注:本文中的github.com/cockroachdb/cockroach/util/metric.Registry.Gauge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。