Consistent HELP message of gauge metrics across check types (#970)
authorNarsing Metpally <nmetpally@axon.com>
Thu, 29 Sep 2022 16:18:07 +0000 (10:18 -0600)
committerGitHub <noreply@github.com>
Thu, 29 Sep 2022 16:18:07 +0000 (21:48 +0530)
Co-authored-by: Suraj Nath <9503187+electron0zero@users.noreply.github.com>
prober/grpc.go
prober/http.go
prober/prober.go
prober/tcp.go

index e24f510021f23f674d00798cd8dfd561653bb60e..45e2d720ac4edc9c3aedb29e5829c12f940fbd27 100644 (file)
@@ -99,12 +99,12 @@ func ProbeGRPC(ctx context.Context, target string, module config.Module, registr
 
                probeSSLEarliestCertExpiryGauge = prometheus.NewGauge(prometheus.GaugeOpts{
                        Name: "probe_ssl_earliest_cert_expiry",
-                       Help: "Returns earliest SSL cert expiry in unixtime",
+                       Help: helpSSLEarliestCertExpiry,
                })
 
                probeTLSVersion = prometheus.NewGaugeVec(prometheus.GaugeOpts{
                        Name: "probe_tls_version_info",
-                       Help: "Contains the TLS version used",
+                       Help: helpProbeTLSInfo,
                },
                        []string{"version"},
                )
index ec54bd78c7dad6b2bf5393c8be774414fcf5e20f..4d65c3a4d0a9fc61defc51f2b69e04125d8cb8b3 100644 (file)
@@ -268,12 +268,12 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr
 
                probeSSLEarliestCertExpiryGauge = prometheus.NewGauge(prometheus.GaugeOpts{
                        Name: "probe_ssl_earliest_cert_expiry",
-                       Help: "Returns earliest SSL cert expiry in unixtime",
+                       Help: helpSSLEarliestCertExpiry,
                })
 
                probeSSLLastChainExpiryTimestampSeconds = prometheus.NewGauge(prometheus.GaugeOpts{
                        Name: "probe_ssl_last_chain_expiry_timestamp_seconds",
-                       Help: "Returns last SSL chain expiry in timestamp seconds",
+                       Help: helpSSLChainExpiryInTimeStamp,
                })
 
                probeSSLLastInformation = prometheus.NewGaugeVec(
@@ -287,7 +287,7 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr
                probeTLSVersion = prometheus.NewGaugeVec(
                        prometheus.GaugeOpts{
                                Name: "probe_tls_version_info",
-                               Help: "Contains the TLS version used",
+                               Help: helpProbeTLSInfo,
                        },
                        []string{"version"},
                )
index dd5cb838b0d2a611907715e55e961e5e72f7b399..ec67e56c206a1ba349e209c33619b32f552416e9 100644 (file)
@@ -23,3 +23,9 @@ import (
 )
 
 type ProbeFn func(ctx context.Context, target string, config config.Module, registry *prometheus.Registry, logger log.Logger) bool
+
+const (
+       helpSSLEarliestCertExpiry     = "Returns last SSL chain expiry in unixtime"
+       helpSSLChainExpiryInTimeStamp = "Returns last SSL chain expiry in timestamp"
+       helpProbeTLSInfo              = "Returns the TLS version used or NaN when unknown"
+)
index 8f2db40d0627a8881fad0b633795aa08e2fafae8..f70e5835b8a612a55f031173ee30cf58d1a1568b 100644 (file)
@@ -91,11 +91,11 @@ func dialTCP(ctx context.Context, target string, module config.Module, registry
 func ProbeTCP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger log.Logger) bool {
        probeSSLEarliestCertExpiry := prometheus.NewGauge(prometheus.GaugeOpts{
                Name: "probe_ssl_earliest_cert_expiry",
-               Help: "Returns earliest SSL cert expiry date",
+               Help: helpSSLEarliestCertExpiry,
        })
        probeSSLLastChainExpiryTimestampSeconds := prometheus.NewGauge(prometheus.GaugeOpts{
                Name: "probe_ssl_last_chain_expiry_timestamp_seconds",
-               Help: "Returns last SSL chain expiry in unixtime",
+               Help: helpSSLChainExpiryInTimeStamp,
        })
        probeSSLLastInformation := prometheus.NewGaugeVec(
                prometheus.GaugeOpts{
@@ -107,7 +107,7 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry
        probeTLSVersion := prometheus.NewGaugeVec(
                prometheus.GaugeOpts{
                        Name: "probe_tls_version_info",
-                       Help: "Returns the TLS version used, or NaN when unknown",
+                       Help: helpProbeTLSInfo,
                },
                []string{"version"},
        )