Skip to content

Commit

Permalink
Update metrics to be counters where appropriate
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Eves <[email protected]>
  • Loading branch information
Evesy committed Apr 7, 2022
1 parent 6cb3e19 commit 2720965
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,20 @@ Further Information
| elasticsearch_clusterinfo_up | gauge | 1 | Up metric for the cluster info collector
| elasticsearch_clusterinfo_version_info | gauge | 6 | Constant metric with ES version information as labels
| elasticsearch_slm_stats_up | gauge | 0 | Up metric for SLM collector
| elasticsearch_slm_stats_total_scrapes | gauge | 0 | Number of scrapes for SLM collector
| elasticsearch_slm_stats_json_parse_failures | gauge | 0 | JSON parse failures for SLM collector
| elasticsearch_slm_stats_retention_runs | gauge | 0 | Total retention runs
| elasticsearch_slm_stats_retention_failed | gauge | 0 | Total failed retention runs
| elasticsearch_slm_stats_retention_timed_out | gauge | 0 | Total retention run timeouts
| elasticsearch_slm_stats_retention_retention_deletion_time_millis | gauge | 0 | Retention run deletion time
| elasticsearch_slm_stats_total_snapshots_taken | gauge | 0 | Total snapshots taken
| elasticsearch_slm_stats_total_snapshots_failed | gauge | 0 | Total snapshots failed
| elasticsearch_slm_stats_total_snapshots_deleted | gauge | 0 | Total snapshots deleted
| elasticsearch_slm_stats_total_snapshots_failed | gauge | 0 | Total snapshots failed
| elasticsearch_slm_stats_snapshots_taken | gauge | 1 | Snapshots taken by policy
| elasticsearch_slm_stats_snapshots_failed | gauge | 1 | Snapshots failed by policy
| elasticsearch_slm_stats_snapshots_deleted | gauge | 1 | Snapshots deleted by policy
| elasticsearch_slm_stats_snapshot_deletion_failures | gauge | 1 | Snapshot deletion failures by policy
| elasticsearch_slm_stats_total_scrapes | counter | 0 | Number of scrapes for SLM collector
| elasticsearch_slm_stats_json_parse_failures | counter | 0 | JSON parse failures for SLM collector
| elasticsearch_slm_stats_retention_runs_total | counter | 0 | Total retention runs
| elasticsearch_slm_stats_retention_failed_total | counter | 0 | Total failed retention runs
| elasticsearch_slm_stats_retention_timed_out_total | counter | 0 | Total retention run timeouts
| elasticsearch_slm_stats_retention_deletion_time_seconds | gauge | 0 | Retention run deletion time
| elasticsearch_slm_stats_total_snapshots_taken_total | counter | 0 | Total snapshots taken
| elasticsearch_slm_stats_total_snapshots_failed_total | counter | 0 | Total snapshots failed
| elasticsearch_slm_stats_total_snapshots_deleted_total | counter | 0 | Total snapshots deleted
| elasticsearch_slm_stats_total_snapshots_failed_total | counter | 0 | Total snapshots failed
| elasticsearch_slm_stats_snapshots_taken_total | counter | 1 | Snapshots taken by policy
| elasticsearch_slm_stats_snapshots_failed_total | counter | 1 | Snapshots failed by policy
| elasticsearch_slm_stats_snapshots_deleted_total | counter | 1 | Snapshots deleted by policy
| elasticsearch_slm_stats_snapshot_deletion_failures_total | counter | 1 | Snapshot deletion failures by policy
| elasticsearch_slm_stats_operation_mode | gauge | 1 | SLM operation mode (Running, stopping, stopped)


Expand Down
44 changes: 22 additions & 22 deletions collector/slm.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
}),
slmMetrics: []*slmMetric{
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "retention_runs"),
prometheus.BuildFQName(namespace, "slm_stats", "retention_runs_total"),
"Total retention runs",
nil, nil,
),
Expand All @@ -101,9 +101,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "retention_failed"),
prometheus.BuildFQName(namespace, "slm_stats", "retention_failed_total"),
"Total failed retention runs",
nil, nil,
),
Expand All @@ -112,9 +112,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "retention_timed_out"),
prometheus.BuildFQName(namespace, "slm_stats", "retention_timed_out_total"),
"Total timed out retention runs",
nil, nil,
),
Expand All @@ -134,9 +134,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_taken"),
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_taken_total"),
"Total snapshots taken",
nil, nil,
),
Expand All @@ -145,9 +145,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_failed"),
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_failed_total"),
"Total snapshots failed",
nil, nil,
),
Expand All @@ -156,9 +156,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_deleted"),
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshots_deleted_total"),
"Total snapshots deleted",
nil, nil,
),
Expand All @@ -167,9 +167,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshot_deletion_failures"),
prometheus.BuildFQName(namespace, "slm_stats", "total_snapshot_deletion_failures_total"),
"Total snapshot deletion failures",
nil, nil,
),
Expand All @@ -180,9 +180,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
},
policyMetrics: []*policyMetric{
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_taken"),
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_taken_total"),
"Total snapshots taken",
defaultPolicyLabels, nil,
),
Expand All @@ -192,9 +192,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
Labels: defaultPolicyLabelValues,
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_failed"),
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_failed_total"),
"Total snapshots failed",
defaultPolicyLabels, nil,
),
Expand All @@ -204,9 +204,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
Labels: defaultPolicyLabelValues,
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_deleted"),
prometheus.BuildFQName(namespace, "slm_stats", "snapshots_deleted_total"),
"Total snapshots deleted",
defaultPolicyLabels, nil,
),
Expand All @@ -216,9 +216,9 @@ func NewSLM(logger log.Logger, client *http.Client, url *url.URL) *SLM {
Labels: defaultPolicyLabelValues,
},
{
Type: prometheus.GaugeValue,
Type: prometheus.CounterValue,
Desc: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "slm_stats", "snapshot_deletion_failures"),
prometheus.BuildFQName(namespace, "slm_stats", "snapshot_deletion_failures_total"),
"Total snapshot deletion failures",
defaultPolicyLabels, nil,
),
Expand Down

0 comments on commit 2720965

Please sign in to comment.