mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 04:22:13 +08:00
refactoring: minor refactoring and handling of known data source plugins
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
// ----------------------
|
||||
|
Reference in New Issue
Block a user