Merge pull request #235 from szook/reorder-functions

reorder functions
This commit is contained in:
Calle Pettersson 2018-08-03 16:42:32 +02:00 committed by GitHub
commit 626a25cd00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}