From 5f6633ad73aa0afb167b0f5c879217f3949f3cfc Mon Sep 17 00:00:00 2001 From: Narsing Metpally Date: Thu, 29 Sep 2022 10:18:07 -0600 Subject: [PATCH] Consistent HELP message of gauge metrics across check types (#970) Co-authored-by: Suraj Nath <9503187+electron0zero@users.noreply.github.com> --- prober/grpc.go | 4 ++-- prober/http.go | 6 +++--- prober/prober.go | 6 ++++++ prober/tcp.go | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/prober/grpc.go b/prober/grpc.go index e24f510..45e2d72 100644 --- a/prober/grpc.go +++ b/prober/grpc.go @@ -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"}, ) diff --git a/prober/http.go b/prober/http.go index ec54bd7..4d65c3a 100644 --- a/prober/http.go +++ b/prober/http.go @@ -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"}, ) diff --git a/prober/prober.go b/prober/prober.go index dd5cb83..ec67e56 100644 --- a/prober/prober.go +++ b/prober/prober.go @@ -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" +) diff --git a/prober/tcp.go b/prober/tcp.go index 8f2db40..f70e583 100644 --- a/prober/tcp.go +++ b/prober/tcp.go @@ -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"}, ) -- 2.25.1