func pointc(name string, v int64) *datapoint.Datapoint {
	return dplocal.NewOnHostDatapointDimensions(
		name,
		datapoint.NewIntValue(v),
		datapoint.Counter,
		map[string]string{"stattype": "golang_sys"})
}
示例#2
0
// Stats returns the number of calls to AddDatapoint
func (e *ErrorTrackerHandler) Stats(dimensions map[string]string) []*datapoint.Datapoint {
	return []*datapoint.Datapoint{
		dplocal.NewOnHostDatapointDimensions(
			"total_errors",
			datapoint.NewIntValue(e.TotalErrors),
			datapoint.Counter,
			dimensions),
	}

}
// Stats related to this forwarder, including errors processing datapoints
func (forwarder *BufferedForwarder) Stats(dimensions map[string]string) []*datapoint.Datapoint {
	ret := make([]*datapoint.Datapoint, 0, 2)
	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"datapoint_chan_backup_size",
		datapoint.NewIntValue(int64(len(forwarder.dpChan))),
		datapoint.Gauge,
		dimensions))
	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"event_chan_backup_size",
		datapoint.NewIntValue(int64(len(forwarder.eChan))),
		datapoint.Gauge,
		dimensions))
	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"datapoint_backup_size",
		datapoint.NewIntValue(atomic.LoadInt64(&forwarder.stats.totalDatapointsBuffered)),
		datapoint.Gauge,
		dimensions))
	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"event_backup_size",
		datapoint.NewIntValue(atomic.LoadInt64(&forwarder.stats.totalEventsBuffered)),
		datapoint.Gauge,
		dimensions))
	return ret
}
示例#4
0
// Stats related to this c, including errors processing datapoints
func (c *Counter) Stats(dimensions map[string]string) []*datapoint.Datapoint {
	ret := make([]*datapoint.Datapoint, 0, 6)

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"total_process_errors",
		datapoint.NewIntValue(atomic.LoadInt64(&c.TotalProcessErrors)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"total_datapoints",
		datapoint.NewIntValue(atomic.LoadInt64(&c.TotalDatapoints)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"total_events",
		datapoint.NewIntValue(atomic.LoadInt64(&c.TotalEvents)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"total_process_calls",
		datapoint.NewIntValue(atomic.LoadInt64(&c.TotalProcessCalls)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"dropped_points",
		datapoint.NewIntValue(atomic.LoadInt64(&c.ProcessErrorPoints)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"process_time_ns",
		datapoint.NewIntValue(atomic.LoadInt64(&c.TotalProcessTimeNs)),
		datapoint.Counter,
		dimensions))

	ret = append(ret, dplocal.NewOnHostDatapointDimensions(
		"calls_in_flight",
		datapoint.NewIntValue(atomic.LoadInt64(&c.CallsInFlight)),
		datapoint.Gauge,
		dimensions))
	return ret
}
示例#5
0
// Stats reports information about the total points seen by carbon
func (listener *Listener) Stats() []*datapoint.Datapoint {
	ret := []*datapoint.Datapoint{}
	stats := map[string]int64{
		"invalid_datapoints": atomic.LoadInt64(&listener.stats.invalidDatapoints),
		"total_connections":  atomic.LoadInt64(&listener.stats.totalConnections),
		"active_connections": atomic.LoadInt64(&listener.stats.activeConnections),
	}
	for k, v := range stats {
		var t datapoint.MetricType
		if k == "active_connections" {
			t = datapoint.Gauge
		} else {
			t = datapoint.Counter
		}
		ret = append(
			ret,
			dplocal.NewOnHostDatapointDimensions(
				k,
				datapoint.NewIntValue(v),
				t,
				map[string]string{"listener": listener.conf.name}))
	}
	return append(ret, listener.st.Stats()...)
}