Example #1
0
func dumpGauge(name string, metric gometrics.Gauge) {
	logger.WithFields(logrus.Fields{
		"name":  name,
		"value": metric.Value(),
	}).Info()
}
Example #2
0
// AddGaugeMetric Adds various metrics based on a Gauge, according to the supplied
// MetricConfig.
func AddGaugeMetric(plugin *newrelic.Plugin, gauge metrics.Gauge, config MetricConfig) {
	if config.Value {
		plugin.AddMetric(newrelic.NewMetric(config.Name+"/Value", config.Unit, func() (float64, error) { return float64(gauge.Snapshot().Value()), nil }))
	}
}