コード例 #1
0
func removeInternalMetrics(config *domain.MetricConfig) {
	// create an empty list of metrics
	var metrics []domain.Metric
	for _, metric := range config.Metrics {
		// and copy metrics, except built in ones
		if metric.BuiltIn {
			continue
		}
		metrics = append(metrics, metric)
	}
	config.Metrics = metrics
}
コード例 #2
0
// addInternalMetrics adds internal metrics to the config. It assumes that
// the current config does not container any internal metrics
func addInternalMetrics(config *domain.MetricConfig) {

	for _, metricName := range internalCounterStats {
		config.Metrics = append(config.Metrics,
			domain.Metric{
				ID:      metricName,
				Name:    metricName,
				Counter: true,
				BuiltIn: true,
			})

	}
	for _, metricName := range internalGuageStats {
		config.Metrics = append(config.Metrics,
			domain.Metric{
				ID:      metricName,
				Name:    metricName,
				Counter: false,
				BuiltIn: true,
			})

	}
}