Commit 323e8437 by Torkel Ödegaard

refactoring: minor refactoring and handling of known data source plugins

parent 3b67a6a2
......@@ -67,7 +67,7 @@ func sendUsageStats() {
// as sending that name could be sensitive information
dsOtherCount := 0
for _, dsStat := range dsStats.Result {
if m.IsStandardDataSource(dsStat.Type) {
if m.IsKnownDataSourcePlugin(dsStat.Type) {
metrics["stats.ds."+dsStat.Type+".count"] = dsStat.Count
} else {
dsOtherCount += dsStat.Count
......
......@@ -47,23 +47,25 @@ type DataSource struct {
Updated time.Time
}
func IsStandardDataSource(dsType string) bool {
switch dsType {
case DS_ES:
return true
case DS_INFLUXDB:
return true
case DS_OPENTSDB:
return true
case DS_CLOUDWATCH:
return true
case DS_PROMETHEUS:
return true
case DS_GRAPHITE:
return true
default:
return false
}
var knownDatasourcePlugins map[string]bool = map[string]bool{
DS_ES: true,
DS_GRAPHITE: true,
DS_INFLUXDB: true,
DS_INFLUXDB_08: true,
DS_KAIROSDB: true,
DS_CLOUDWATCH: true,
DS_PROMETHEUS: true,
DS_OPENTSDB: true,
"opennms": true,
"druid": true,
"dalmatinerdb": true,
"gnocci": true,
"zabbix": true,
}
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