reorder functions

so that the two functions that list available child collectors are next
to each other - should make less likely to not miss editing one of those
when adding additional wmi classes

also removed the 'filter' from the `mssqlFilterAvailableClassCollectors`
function as it's not filtering anyting.
This commit is contained in:
Steve Zook 2018-08-03 09:48:32 -04:00
parent fe4c61a70e
commit d83615a818

View File

@ -37,7 +37,7 @@ var (
mssqlEnabledCollectors = kingpin.Flag(
"collectors.mssql.classes-enabled",
"Comma-separated list of mssql WMI classes to use.").
Default(mssqlFilterAvailableClassCollectors()).String()
Default(mssqlAvailableClassCollectors()).String()
mssqlPrintCollectors = kingpin.Flag(
"collectors.mssql.class-print",
@ -80,10 +80,24 @@ func getMSSQLInstances() mssqlInstancesType {
type mssqlCollectorsMap map[string]mssqlCollectorFunc
func mssqlFilterAvailableClassCollectors() string {
func mssqlAvailableClassCollectors() string {
return "availreplica,bufman,databases,dbreplica,genstats,locks,memmgr,sqlstats"
}
func (c *MSSQLCollector) getMSSQLCollectors() mssqlCollectorsMap {
mssqlCollectors := make(mssqlCollectorsMap)
mssqlCollectors["availreplica"] = c.collectAvailabilityReplica
mssqlCollectors["bufman"] = c.collectBufferManager
mssqlCollectors["databases"] = c.collectDatabases
mssqlCollectors["dbreplica"] = c.collectDatabaseReplica
mssqlCollectors["genstats"] = c.collectGeneralStatistics
mssqlCollectors["locks"] = c.collectLocks
mssqlCollectors["memmgr"] = c.collectMemoryManager
mssqlCollectors["sqlstats"] = c.collectSQLStats
return mssqlCollectors
}
func mssqlExpandEnabledCollectors(enabled string) []string {
separated := strings.Split(enabled, ",")
unique := map[string]bool{}
@ -99,20 +113,6 @@ func mssqlExpandEnabledCollectors(enabled string) []string {
return result
}
func (c *MSSQLCollector) getMSSQLCollectors() mssqlCollectorsMap {
mssqlCollectors := make(mssqlCollectorsMap)
mssqlCollectors["availreplica"] = c.collectAvailabilityReplica
mssqlCollectors["bufman"] = c.collectBufferManager
mssqlCollectors["databases"] = c.collectDatabases
mssqlCollectors["dbreplica"] = c.collectDatabaseReplica
mssqlCollectors["genstats"] = c.collectGeneralStatistics
mssqlCollectors["locks"] = c.collectLocks
mssqlCollectors["memmgr"] = c.collectMemoryManager
mssqlCollectors["sqlstats"] = c.collectSQLStats
return mssqlCollectors
}
func init() {
Factories["mssql"] = NewMSSQLCollector
}