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


Golang Metric.AddDimension方法代码示例

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


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

示例1: addDimensionsFromName

func addDimensionsFromName(m *metric.Metric, dimensions []string) {
	var dimension []string
	for i := 1; i < len(dimensions); i++ {
		dimension = strings.Split(dimensions[i], "=")
		m.AddDimension(dimension[0], dimension[1])
	}

}
开发者ID:Yelp,项目名称:fullerite,代码行数:8,代码来源:java_metric.go

示例2: Collect

// Collect reads metrics collected from Diamond collectors, converts
// them to fullerite's Metric type and publishes them to handlers.
func (d Diamond) Collect() {
	for line := range d.incoming {
		var metric metric.Metric
		if err := json.Unmarshal(line, &metric); err != nil {
			log.Error("Cannot unmarshal metric line from diamond:", line)
			continue
		}
		metric.AddDimension("diamond", "yes")
		d.Channel() <- metric
	}
}
开发者ID:chrisenuf,项目名称:fullerite,代码行数:13,代码来源:diamond.go

示例3: parseMetric

func (d *Diamond) parseMetric(line []byte) (metric.Metric, bool) {
	var metric metric.Metric
	if err := json.Unmarshal(line, &metric); err != nil {
		d.log.Error("Cannot unmarshal metric line from diamond:", line)
		return metric, false
	}
	// All diamond metric_types are reported in uppercase, lets make them
	// fullerite compatible
	metric.MetricType = strings.ToLower(metric.MetricType)
	metric.AddDimension("diamond", "yes")
	return metric, true
}
开发者ID:gsalisbury,项目名称:fullerite,代码行数:12,代码来源:diamond.go

示例4: Collect

// Collect reads metrics collected from Diamond collectors, converts
// them to fullerite's Metric type and publishes them to handlers.
func (d *Diamond) Collect() {
	if !d.serverStarted {
		d.serverStarted = true
		go d.collectDiamond()
	}

	for line := range d.incoming {
		var metric metric.Metric
		if err := json.Unmarshal(line, &metric); err != nil {
			d.log.Error("Cannot unmarshal metric line from diamond:", line)
			continue
		}
		metric.AddDimension("diamond", "yes")
		d.Channel() <- metric
	}
}
开发者ID:jp2007,项目名称:fullerite,代码行数:18,代码来源:diamond.go


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