Commit 323e8437 by Torkel Ödegaard

refactoring: minor refactoring and handling of known data source plugins

parent 3b67a6a2
...@@ -67,7 +67,7 @@ func sendUsageStats() { ...@@ -67,7 +67,7 @@ func sendUsageStats() {
// as sending that name could be sensitive information // as sending that name could be sensitive information
dsOtherCount := 0 dsOtherCount := 0
for _, dsStat := range dsStats.Result { for _, dsStat := range dsStats.Result {
if m.IsStandardDataSource(dsStat.Type) { if m.IsKnownDataSourcePlugin(dsStat.Type) {
metrics["stats.ds."+dsStat.Type+".count"] = dsStat.Count metrics["stats.ds."+dsStat.Type+".count"] = dsStat.Count
} else { } else {
dsOtherCount += dsStat.Count dsOtherCount += dsStat.Count
......
...@@ -47,23 +47,25 @@ type DataSource struct { ...@@ -47,23 +47,25 @@ type DataSource struct {
Updated time.Time Updated time.Time
} }
func IsStandardDataSource(dsType string) bool { var knownDatasourcePlugins map[string]bool = map[string]bool{
switch dsType { DS_ES: true,
case DS_ES: DS_GRAPHITE: true,
return true DS_INFLUXDB: true,
case DS_INFLUXDB: DS_INFLUXDB_08: true,
return true DS_KAIROSDB: true,
case DS_OPENTSDB: DS_CLOUDWATCH: true,
return true DS_PROMETHEUS: true,
case DS_CLOUDWATCH: DS_OPENTSDB: true,
return true "opennms": true,
case DS_PROMETHEUS: "druid": true,
return true "dalmatinerdb": true,
case DS_GRAPHITE: "gnocci": true,
return true "zabbix": true,
default: }
return false
} func IsKnownDataSourcePlugin(dsType string) bool {
_, exists := knownDatasourcePlugins[dsType]
return exists
} }
// ---------------------- // ----------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment