4444 //reg := prometheus.NewRegistry()
4545 prometheus .MustRegister (c )
4646 promCollector = c
47- c .StartCacheInvalidator ()
47+ _ = c .StartCacheInvalidator ()
4848 srv = buildHTTPServer (prometheus .DefaultGatherer , conf )
4949 err = srv .ListenAndServe ()
5050
@@ -114,7 +114,7 @@ func buildHTTPServer(reg prometheus.Gatherer, conf config.Config) *http.Server {
114114}
115115
116116func main () {
117- rootCmd .Execute ()
117+ _ = rootCmd .Execute ()
118118}
119119
120120func init () {
@@ -126,18 +126,18 @@ func init() {
126126 rootCmd .PersistentFlags ().StringVarP (& bind , "bind" , "b" , config .DefaultBindAddr , "Address to bind http server (default is :9412)" )
127127 rootCmd .PersistentFlags ().StringVarP (& metricsPath , "path" , "p" , config .DefaultMetricsPath , "Metric path (default is /metrics)" )
128128 rootCmd .PersistentFlags ().DurationVarP (& queryTimeout , "query-timeout" , "t" , config .DefaultQueryTimeout , "Timeout for MongoDB queries" )
129- viper .BindPFlag ("log.level" , rootCmd .PersistentFlags ().Lookup ("log-level" ))
130- viper .BindPFlag ("log.encoding" , rootCmd .PersistentFlags ().Lookup ("log-encoding" ))
131- viper .BindPFlag ("bind" , rootCmd .PersistentFlags ().Lookup ("bind" ))
132- viper .BindPFlag ("metricsPath" , rootCmd .PersistentFlags ().Lookup ("path" ))
133- viper .BindPFlag ("mongodb.uri" , rootCmd .PersistentFlags ().Lookup ("uri" ))
134- viper .BindPFlag ("mongodb.queryTimeout" , rootCmd .PersistentFlags ().Lookup ("query-timeout" ))
135- viper .BindEnv ("mongodb.uri" , "MDBEXPORTER_MONGODB_URI" )
136- viper .BindEnv ("global.queryTimeout" , "MDBEXPORTER_MONGODB_QUERY_TIMEOUT" )
137- viper .BindEnv ("log.level" , "MDBEXPORTER_LOG_LEVEL" )
138- viper .BindEnv ("log.encoding" , "MDBEXPORTER_LOG_ENCODING" )
139- viper .BindEnv ("bind" , "MDBEXPORTER_BIND" )
140- viper .BindEnv ("metricsPath" , "MDBEXPORTER_METRICSPATH" )
129+ _ = viper .BindPFlag ("log.level" , rootCmd .PersistentFlags ().Lookup ("log-level" ))
130+ _ = viper .BindPFlag ("log.encoding" , rootCmd .PersistentFlags ().Lookup ("log-encoding" ))
131+ _ = viper .BindPFlag ("bind" , rootCmd .PersistentFlags ().Lookup ("bind" ))
132+ _ = viper .BindPFlag ("metricsPath" , rootCmd .PersistentFlags ().Lookup ("path" ))
133+ _ = viper .BindPFlag ("mongodb.uri" , rootCmd .PersistentFlags ().Lookup ("uri" ))
134+ _ = viper .BindPFlag ("mongodb.queryTimeout" , rootCmd .PersistentFlags ().Lookup ("query-timeout" ))
135+ _ = viper .BindEnv ("mongodb.uri" , "MDBEXPORTER_MONGODB_URI" )
136+ _ = viper .BindEnv ("global.queryTimeout" , "MDBEXPORTER_MONGODB_QUERY_TIMEOUT" )
137+ _ = viper .BindEnv ("log.level" , "MDBEXPORTER_LOG_LEVEL" )
138+ _ = viper .BindEnv ("log.encoding" , "MDBEXPORTER_LOG_ENCODING" )
139+ _ = viper .BindEnv ("bind" , "MDBEXPORTER_BIND" )
140+ _ = viper .BindEnv ("metricsPath" , "MDBEXPORTER_METRICSPATH" )
141141}
142142
143143func initConfig () {
0 commit comments