コード例 #1
0
ファイル: java_metric.go プロジェクト: Yelp/fullerite
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])
	}

}
コード例 #2
0
ファイル: diamond.go プロジェクト: chrisenuf/fullerite
// 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
	}
}
コード例 #3
0
ファイル: diamond.go プロジェクト: gsalisbury/fullerite
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
}
コード例 #4
0
ファイル: diamond.go プロジェクト: jp2007/fullerite
// 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
	}
}