@@ -102,7 +102,7 @@ func NewExporter(dsn string) *Exporter {
102
102
log .Errorln ("Error while connecting to" , dsn )
103
103
panic (err )
104
104
}
105
- log .Debugln ("Successfully connected to: " , dsn )
105
+ log .Debugln ("Successfully connected to: " , dsn )
106
106
return & Exporter {
107
107
dsn : dsn ,
108
108
duration : prometheus .NewGauge (prometheus.GaugeOpts {
@@ -213,35 +213,35 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
213
213
e .up .Set (0 )
214
214
return
215
215
} else {
216
- log .Debugln ("Successfully pinged Oracle database: " )
216
+ log .Debugln ("Successfully pinged Oracle database: " )
217
217
e .up .Set (1 )
218
218
}
219
219
220
220
for _ , metric := range metricsToScrap .Metric {
221
- log .Debugln ("About to scrape metric: " )
222
- log .Debugln ("- Metric MetricsDesc: " , metric .MetricsDesc )
223
- log .Debugln ("- Metric Context: " , metric .Context )
224
- log .Debugln ("- Metric MetricsType: " , metric .MetricsType )
225
- log .Debugln ("- Metric Labels: " , metric .Labels )
226
- log .Debugln ("- Metric FieldToAppend: " , metric .FieldToAppend )
227
- log .Debugln ("- Metric IgnoreZeroResult: " , metric .IgnoreZeroResult )
228
- log .Debugln ("- Metric Request: " , metric .Request )
229
-
230
- if len (metric .Request ) == 0 {
231
- log .Errorln ("Error scraping for " , metric .MetricsDesc , ". Did you forget to define request in your toml file?" )
232
- continue
233
- }
234
-
235
- if len (metric .MetricsDesc ) == 0 {
236
- log .Errorln ("Error scraping for query" , metric .Request , ". Did you forget to define metricsdesc in your toml file?" )
237
- continue
238
- }
239
-
221
+ log .Debugln ("About to scrape metric: " )
222
+ log .Debugln ("- Metric MetricsDesc: " , metric .MetricsDesc )
223
+ log .Debugln ("- Metric Context: " , metric .Context )
224
+ log .Debugln ("- Metric MetricsType: " , metric .MetricsType )
225
+ log .Debugln ("- Metric Labels: " , metric .Labels )
226
+ log .Debugln ("- Metric FieldToAppend: " , metric .FieldToAppend )
227
+ log .Debugln ("- Metric IgnoreZeroResult: " , metric .IgnoreZeroResult )
228
+ log .Debugln ("- Metric Request: " , metric .Request )
229
+
230
+ if len (metric .Request ) == 0 {
231
+ log .Errorln ("Error scraping for " , metric .MetricsDesc , ". Did you forget to define request in your toml file?" )
232
+ continue
233
+ }
234
+
235
+ if len (metric .MetricsDesc ) == 0 {
236
+ log .Errorln ("Error scraping for query" , metric .Request , ". Did you forget to define metricsdesc in your toml file?" )
237
+ continue
238
+ }
239
+
240
240
if err = ScrapeMetric (e .db , ch , metric ); err != nil {
241
241
log .Errorln ("Error scraping for" , metric .Context , "_" , metric .MetricsDesc , ":" , err )
242
242
e .scrapeErrors .WithLabelValues (metric .Context ).Inc ()
243
243
} else {
244
- log .Debugln ("Successfully scrapped metric: " , metric .Context )
244
+ log .Debugln ("Successfully scrapped metric: " , metric .Context )
245
245
}
246
246
}
247
247
@@ -266,7 +266,7 @@ func GetMetricType(metricType string, metricsType map[string]string) prometheus.
266
266
267
267
// interface method to call ScrapeGenericValues using Metric struct values
268
268
func ScrapeMetric (db * sql.DB , ch chan <- prometheus.Metric , metricDefinition Metric ) error {
269
- log .Debugln ("Calling function ScrapeGenericValues()" )
269
+ log .Debugln ("Calling function ScrapeGenericValues()" )
270
270
return ScrapeGenericValues (db , ch , metricDefinition .Context , metricDefinition .Labels ,
271
271
metricDefinition .MetricsDesc , metricDefinition .MetricsType ,
272
272
metricDefinition .FieldToAppend , metricDefinition .IgnoreZeroResult ,
@@ -292,7 +292,7 @@ func ScrapeGenericValues(db *sql.DB, ch chan<- prometheus.Metric, context string
292
292
",metricHelp=" + metricHelp + ",value=<" + row [metric ] + ">)" )
293
293
continue
294
294
}
295
- log .Debugln ("Query result looks like: " , value )
295
+ log .Debugln ("Query result looks like: " , value )
296
296
// If metric do not use a field content in metric's name
297
297
if strings .Compare (fieldToAppend , "" ) == 0 {
298
298
desc := prometheus .NewDesc (
@@ -398,8 +398,8 @@ func main() {
398
398
if _ , err := toml .DecodeFile (* defaultFileMetrics , & metricsToScrap ); err != nil {
399
399
log .Errorln (err )
400
400
panic (errors .New ("Error while loading " + * defaultFileMetrics ))
401
- } else {
402
- log .Infoln ("Successfully loaded default metrics from: " + * defaultFileMetrics )
401
+ } else {
402
+ log .Infoln ("Successfully loaded default metrics from: " + * defaultFileMetrics )
403
403
}
404
404
405
405
// If custom metrics, load it
@@ -408,12 +408,12 @@ func main() {
408
408
log .Errorln (err )
409
409
panic (errors .New ("Error while loading " + * customMetrics ))
410
410
} else {
411
- log .Infoln ("Successfully loaded custom metrics from: " + * customMetrics )
412
- }
411
+ log .Infoln ("Successfully loaded custom metrics from: " + * customMetrics )
412
+ }
413
413
414
414
metricsToScrap .Metric = append (metricsToScrap .Metric , additionalMetrics .Metric ... )
415
415
} else {
416
- log .Infoln ("No custom metrics defined." )
416
+ log .Infoln ("No custom metrics defined." )
417
417
}
418
418
exporter := NewExporter (dsn )
419
419
prometheus .MustRegister (exporter )
0 commit comments