当前位置: 首页>>代码示例>>Golang>>正文


Golang Registry.Latency方法代码示例

本文整理汇总了Golang中github.com/cockroachdb/cockroach/util/metric.Registry.Latency方法的典型用法代码示例。如果您正苦于以下问题:Golang Registry.Latency方法的具体用法?Golang Registry.Latency怎么用?Golang Registry.Latency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cockroachdb/cockroach/util/metric.Registry的用法示例。


在下文中一共展示了Registry.Latency方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewExecutor

// NewExecutor creates an Executor and registers a callback on the
// system config.
func NewExecutor(db client.DB, gossip *gossip.Gossip, leaseMgr *LeaseManager, metaRegistry *metric.Registry, stopper *stop.Stopper) *Executor {
	exec := &Executor{
		db:       db,
		reCache:  parser.NewRegexpCache(512),
		leaseMgr: leaseMgr,

		latency: metaRegistry.Latency("sql.latency"),
	}
	exec.systemConfigCond = sync.NewCond(&exec.systemConfigMu)

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

	return exec
}
开发者ID:harryge00,项目名称:cockroach,代码行数:27,代码来源:executor.go

示例2: 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

示例3: makeNodeMetrics

func makeNodeMetrics(reg *metric.Registry) nodeMetrics {
	return nodeMetrics{
		registry: reg,
		latency:  reg.Latency(execLatencyName),
		success:  reg.Rates(execSuccessName),
		err:      reg.Rates(execErrorName),
	}
}
开发者ID:yangxuanjia,项目名称:cockroach,代码行数:8,代码来源:node.go

示例4: NewTxnMetrics

// NewTxnMetrics returns a new instance of txnMetrics that contains metrics which have
// been registered with the provided Registry.
func NewTxnMetrics(txnRegistry *metric.Registry) *TxnMetrics {
	return &TxnMetrics{
		Aborts:    txnRegistry.Rates(abortsPrefix),
		Commits:   txnRegistry.Rates(commitsPrefix),
		Abandons:  txnRegistry.Rates(abandonsPrefix),
		Durations: txnRegistry.Latency(durationsPrefix),
		Restarts:  txnRegistry.Histogram(restartsKey, 60*time.Second, 100, 3),
	}
}
开发者ID:cuongdo,项目名称:cockroach,代码行数:11,代码来源:txn_coord_sender.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(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


注:本文中的github.com/cockroachdb/cockroach/util/metric.Registry.Latency方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。