Beispiel #1
0
func makeNodeMetrics(reg *metric.Registry) nodeMetrics {
	nm := nodeMetrics{
		Latency: metric.NewLatency(metaExecLatency),
		Success: metric.NewRates(metaExecSuccess),
		Err:     metric.NewRates(metaExecError),
	}
	reg.AddMetricStruct(nm)
	return nm
}
Beispiel #2
0
// newServer creates and returns a server struct.
func newServer(ctx context.Context, stopper *stop.Stopper, registry *metric.Registry) *server {
	s := &server{
		ctx:           ctx,
		stopper:       stopper,
		tighten:       make(chan roachpb.NodeID, 1),
		nodeMetrics:   makeMetrics(),
		serverMetrics: makeMetrics(),
	}

	s.mu.is = newInfoStore(ctx, 0, util.UnresolvedAddr{}, stopper)
	s.mu.incoming = makeNodeSet(minPeers, metric.NewGauge(MetaConnectionsIncomingGauge))
	s.mu.nodeMap = make(map[util.UnresolvedAddr]serverInfo)
	s.mu.ready = make(chan struct{})

	registry.AddMetric(s.mu.incoming.gauge)
	registry.AddMetricStruct(s.nodeMetrics)

	return s
}