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


Golang Registry.Counter方法代碼示例

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


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

示例1: newServerMetrics

func newServerMetrics(reg *metric.Registry) *serverMetrics {
	return &serverMetrics{
		conns:         reg.Counter(MetricConnsName),
		bytesInCount:  reg.Counter(MetricBytesInName),
		bytesOutCount: reg.Counter(MetricBytesOutName),
	}
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:7,代碼來源:server.go

示例2: newServerMetrics

func newServerMetrics(reg *metric.Registry) *serverMetrics {
	return &serverMetrics{
		conns:         reg.Counter("conns"),
		bytesInCount:  reg.Counter("bytesin"),
		bytesOutCount: reg.Counter("bytesout"),
	}
}
開發者ID:CubeLite,項目名稱:cockroach,代碼行數:7,代碼來源:server.go

示例3: MakeServer

// MakeServer creates a Server, adding network stats to the given Registry.
func MakeServer(context *base.Context, executor *sql.Executor, reg *metric.Registry) *Server {
	return &Server{
		context:  context,
		executor: executor,
		registry: reg,
		metrics: &serverMetrics{
			conns:         reg.Counter("conns"),
			bytesInCount:  reg.Counter("bytesin"),
			bytesOutCount: reg.Counter("bytesout"),
		},
	}
}
開發者ID:GitGoldie,項目名稱:cockroach,代碼行數:13,代碼來源:server.go

示例4: NewExecutor

// NewExecutor creates an Executor and registers a callback on the
// system config.
func NewExecutor(ctx ExecutorContext, stopper *stop.Stopper, registry *metric.Registry) *Executor {
	exec := &Executor{
		ctx:     ctx,
		reCache: parser.NewRegexpCache(512),

		registry:         registry,
		latency:          registry.Latency(MetricLatencyName),
		txnBeginCount:    registry.Counter(MetricTxnBeginName),
		txnCommitCount:   registry.Counter(MetricTxnCommitName),
		txnAbortCount:    registry.Counter(MetricTxnAbortName),
		txnRollbackCount: registry.Counter(MetricTxnRollbackName),
		selectCount:      registry.Counter(MetricSelectName),
		updateCount:      registry.Counter(MetricUpdateName),
		insertCount:      registry.Counter(MetricInsertName),
		deleteCount:      registry.Counter(MetricDeleteName),
		ddlCount:         registry.Counter(MetricDdlName),
		miscCount:        registry.Counter(MetricMiscName),
		queryCount:       registry.Counter(MetricQueryName),
	}
	exec.systemConfigCond = sync.NewCond(exec.systemConfigMu.RLocker())

	gossipUpdateC := ctx.Gossip.RegisterSystemConfigChannel()
	stopper.RunWorker(func() {
		for {
			select {
			case <-gossipUpdateC:
				cfg, _ := ctx.Gossip.GetSystemConfig()
				exec.updateSystemConfig(cfg)
			case <-stopper.ShouldStop():
				return
			}
		}
	})

	return exec
}
開發者ID:yangxuanjia,項目名稱:cockroach,代碼行數:38,代碼來源:executor.go

示例5: NewExecutor

// NewExecutor creates an Executor and registers a callback on the
// system config.
func NewExecutor(ctx ExecutorContext, stopper *stop.Stopper, registry *metric.Registry) *Executor {
	exec := &Executor{
		ctx:     ctx,
		reCache: parser.NewRegexpCache(512),

		registry:         registry,
		latency:          registry.Latency("latency"),
		txnBeginCount:    registry.Counter("txn.begin.count"),
		txnCommitCount:   registry.Counter("txn.commit.count"),
		txnAbortCount:    registry.Counter("txn.abort.count"),
		txnRollbackCount: registry.Counter("txn.rollback.count"),
		selectCount:      registry.Counter("select.count"),
		updateCount:      registry.Counter("update.count"),
		insertCount:      registry.Counter("insert.count"),
		deleteCount:      registry.Counter("delete.count"),
		ddlCount:         registry.Counter("ddl.count"),
		miscCount:        registry.Counter("misc.count"),
	}
	exec.systemConfigCond = sync.NewCond(exec.systemConfigMu.RLocker())

	gossipUpdateC := ctx.Gossip.RegisterSystemConfigChannel()
	stopper.RunWorker(func() {
		for {
			select {
			case <-gossipUpdateC:
				cfg, _ := ctx.Gossip.GetSystemConfig()
				exec.updateSystemConfig(cfg)
			case <-stopper.ShouldStop():
				return
			}
		}
	})

	return exec
}
開發者ID:cuongdo,項目名稱:cockroach,代碼行數:37,代碼來源:executor.go


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