cleanup and README

Signed-off-by: Joe Adams <github@joeadams.io>

Co-authored-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Joe Adams
2022-06-28 22:22:14 -04:00
parent cc751b7966
commit 8f8d2208f5
4 changed files with 39 additions and 27 deletions

View File

@@ -102,12 +102,6 @@ func main() {
os.Exit(1)
}
// TODO(@sysadmind): Remove this with multi-target support
// if len(dsn) == 0 {
// level.Error(logger).Log("msg", "Couldn't find environment variables describing the datasource to use")
// os.Exit(1)
// }
opts := []ExporterOpt{
DisableDefaultMetrics(*disableDefaultMetrics),
DisableSettingsMetrics(*disableSettingsMetrics),

View File

@@ -60,7 +60,7 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
return
}
// TODO: Timeout
// TODO(@sysadmind): Timeout
probeSuccessGauge := prometheus.NewGauge(prometheus.GaugeOpts{
Name: "probe_success",
@@ -86,23 +86,15 @@ func handleProbe(logger log.Logger) http.HandlerFunc {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
// TODO(@sysadmind): Remove the registry.MustRegister() call below and instead handle the collection here. That will allow
// for the passing of context, handling of timeouts, and more control over the collection.
// The current NewProbeCollector() implementation relies on the MustNewConstMetric() call to create the metrics which is not
// ideal to use without the registry.MustRegister() call.
_ = ctx
// TODO: Which way should this be? Register or handle the collection manually?
// Also, what about the context?
// Option 1: Register the collector
registry.MustRegister(pc)
// Option 2: Handle the collection manually. This allows us to collect duration metrics.
// The collectors themselves already support their own duration metrics.
// err = pc.Update(ctx)
// if err != nil {
// probeSuccessGauge.Set(0)
// } else {
// probeSuccessGauge.Set(1)
// }
duration := time.Since(start).Seconds()
probeDurationGauge.Set(duration)