本文整理汇总了Golang中expvar.NewInt函数的典型用法代码### 示例。如果您正苦于以下问题:Golang NewInt函数的具体用法?Golang NewInt怎么用?Golang NewInt使用的例子?那么恭喜您, 这里精选的函数代码### 示例或许可以为您提供帮助。
在下文中一共展示了NewInt函数的20个代码### 示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码### 示例。
示例1: init
func init() {
recordsRead = expvar.NewInt("RecordsRead")
recordsWritten = expvar.NewInt("RecordsWritten")
bytesRead = expvar.NewInt("BytesRead")
bytesWritten = expvar.NewInt("BytesWritten")
seeks = expvar.NewInt("Seeks")
}
开发者ID:sburnett,项目名称:transformer,代码行数:7,代码来源:leveldb.go
示例2: init
func init() {
stats.cacheTotal = expvar.NewInt("cache-total")
stats.cacheBypassed = expvar.NewInt("cache-bypassed")
stats.cacheHits = expvar.NewInt("cache-hits")
stats.cacheMisses = expvar.NewInt("cache-misses")
stats.cacheRecorded = expvar.NewInt("cache-recorded")
}
开发者ID:albertito,项目名称:dnss,代码行数:7,代码来源:resolver.go
示例3: NewPubMetrics
func NewPubMetrics(gw *Gateway) *pubMetrics {
this := &pubMetrics{
gw: gw,
PubOkMap: make(map[string]metrics.Counter),
PubFailMap: make(map[string]metrics.Counter),
ClientError: metrics.NewRegisteredCounter("pub.clienterr", metrics.DefaultRegistry),
PubQps: metrics.NewRegisteredMeter("pub.qps", metrics.DefaultRegistry),
PubTryQps: metrics.NewRegisteredMeter("pub.try.qps", metrics.DefaultRegistry),
JobQps: metrics.NewRegisteredMeter("job.qps", metrics.DefaultRegistry),
JobTryQps: metrics.NewRegisteredMeter("job.try.qps", metrics.DefaultRegistry),
PubMsgSize: metrics.NewRegisteredHistogram("pub.msgsize", metrics.DefaultRegistry, metrics.NewExpDecaySample(1028, 0.015)),
JobMsgSize: metrics.NewRegisteredHistogram("job.msgsize", metrics.DefaultRegistry, metrics.NewExpDecaySample(1028, 0.015)),
PubLatency: metrics.NewRegisteredHistogram("pub.latency", metrics.DefaultRegistry, metrics.NewExpDecaySample(1028, 0.015)),
}
if Options.DebugHttpAddr != "" {
this.expPubOk = expvar.NewInt("PubOk")
this.expPubFail = expvar.NewInt("PubFail")
this.expActiveConns = expvar.NewInt("PubConns") // TODO
this.expActiveUpstream = expvar.NewInt("PubUpstream") // TODO
}
return this
}
开发者ID:funkygao,项目名称:gafka,代码行数:25,代码来源:metrics_pub.go
示例4: init
/*
* Initializations
*/
func init() {
flag.Parse()
status.InputEventCount = expvar.NewInt("input_event_count")
status.OutputEventCount = expvar.NewInt("output_event_count")
status.ErrorCount = expvar.NewInt("error_count")
expvar.Publish("connection_status",
expvar.Func(func() interface{} {
res := make(map[string]interface{}, 0)
res["last_connect_time"] = status.LastConnectTime
res["last_error_text"] = status.LastConnectError
res["last_error_time"] = status.ErrorTime
if status.IsConnected {
res["connected"] = true
res["uptime"] = time.Now().Sub(status.LastConnectTime).Seconds()
} else {
res["connected"] = false
res["uptime"] = 0.0
}
return res
}))
expvar.Publish("uptime", expvar.Func(func() interface{} {
return time.Now().Sub(status.StartTime).Seconds()
}))
expvar.Publish("subscribed_events", expvar.Func(func() interface{} {
return config.EventTypes
}))
results = make(chan string, 100)
output_errors = make(chan error)
status.StartTime = time.Now()
}
开发者ID:carbonblack,项目名称:cb-event-forwarder,代码行数:37,代码来源:main.go
示例5: NewMetrics
//NewMetrics creates
//Metrics object
func NewMetrics() *Metrics {
metrics = &Metrics{
true,
expvar.NewInt("comparisons"),
expvar.NewInt("errors"),
expvar.NewString("database"),
}
return metrics
}
开发者ID:sohlich,项目名称:go-plag,代码行数:11,代码来源:metrics.go
最后编辑: kuteng 文档更新时间: 2021-08-23 19:14 作者:kuteng