Skip to content

Commit d2dfec7

Browse files
committed
Apply go fmt.
1 parent 0422301 commit d2dfec7

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

main.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func NewExporter(dsn string) *Exporter {
102102
log.Errorln("Error while connecting to", dsn)
103103
panic(err)
104104
}
105-
log.Debugln("Successfully connected to: ", dsn)
105+
log.Debugln("Successfully connected to: ", dsn)
106106
return &Exporter{
107107
dsn: dsn,
108108
duration: prometheus.NewGauge(prometheus.GaugeOpts{
@@ -213,35 +213,35 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) {
213213
e.up.Set(0)
214214
return
215215
} else {
216-
log.Debugln("Successfully pinged Oracle database: ")
216+
log.Debugln("Successfully pinged Oracle database: ")
217217
e.up.Set(1)
218218
}
219219

220220
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+
240240
if err = ScrapeMetric(e.db, ch, metric); err != nil {
241241
log.Errorln("Error scraping for", metric.Context, "_", metric.MetricsDesc, ":", err)
242242
e.scrapeErrors.WithLabelValues(metric.Context).Inc()
243243
} else {
244-
log.Debugln("Successfully scrapped metric: ", metric.Context)
244+
log.Debugln("Successfully scrapped metric: ", metric.Context)
245245
}
246246
}
247247

@@ -266,7 +266,7 @@ func GetMetricType(metricType string, metricsType map[string]string) prometheus.
266266

267267
// interface method to call ScrapeGenericValues using Metric struct values
268268
func ScrapeMetric(db *sql.DB, ch chan<- prometheus.Metric, metricDefinition Metric) error {
269-
log.Debugln("Calling function ScrapeGenericValues()")
269+
log.Debugln("Calling function ScrapeGenericValues()")
270270
return ScrapeGenericValues(db, ch, metricDefinition.Context, metricDefinition.Labels,
271271
metricDefinition.MetricsDesc, metricDefinition.MetricsType,
272272
metricDefinition.FieldToAppend, metricDefinition.IgnoreZeroResult,
@@ -292,7 +292,7 @@ func ScrapeGenericValues(db *sql.DB, ch chan<- prometheus.Metric, context string
292292
",metricHelp=" + metricHelp + ",value=<" + row[metric] + ">)")
293293
continue
294294
}
295-
log.Debugln("Query result looks like: ", value)
295+
log.Debugln("Query result looks like: ", value)
296296
// If metric do not use a field content in metric's name
297297
if strings.Compare(fieldToAppend, "") == 0 {
298298
desc := prometheus.NewDesc(
@@ -398,8 +398,8 @@ func main() {
398398
if _, err := toml.DecodeFile(*defaultFileMetrics, &metricsToScrap); err != nil {
399399
log.Errorln(err)
400400
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)
403403
}
404404

405405
// If custom metrics, load it
@@ -408,12 +408,12 @@ func main() {
408408
log.Errorln(err)
409409
panic(errors.New("Error while loading " + *customMetrics))
410410
} else {
411-
log.Infoln("Successfully loaded custom metrics from: " + *customMetrics)
412-
}
411+
log.Infoln("Successfully loaded custom metrics from: " + *customMetrics)
412+
}
413413

414414
metricsToScrap.Metric = append(metricsToScrap.Metric, additionalMetrics.Metric...)
415415
} else {
416-
log.Infoln("No custom metrics defined.")
416+
log.Infoln("No custom metrics defined.")
417417
}
418418
exporter := NewExporter(dsn)
419419
prometheus.MustRegister(exporter)

0 commit comments

Comments
 (0)