Skip to content

Commit

Permalink
Rename a metric to _total
Browse files Browse the repository at this point in the history
Rename a metric to _total because grafana now warns when you use a
metric that does not match this pattern as you would a counter.
  • Loading branch information
ties committed Apr 23, 2024
1 parent e6b5774 commit 3498f4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2024-xx-yy (v0.x.y)

* Add `modem_downstream_errors_total` that will replace
`modem_downstream_errors` metric (clearer name).
* **deprecated** the `modem_downstream_errors` metric. Will be removed on or after 1-7-2024.

## 2024-03-09 (v0.5.0)

Expand Down
17 changes: 17 additions & 0 deletions sagemcom_f3896_client/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ async def __update_downstream_channel_metrics(

# Technically a counter, but counter value can not be set
metric_downstream_errors = Gauge(
"modem_downstream_errors_total",
"Downstream errors",
["channel", "channel_type", "error_type"],
registry=registry,
)
# added on 23-4-2024
metric_downstream_errors_legacy = Gauge(
"modem_downstream_errors",
"Downstream errors",
["channel", "channel_type", "error_type"],
Expand Down Expand Up @@ -390,6 +397,16 @@ async def __update_downstream_channel_metrics(
channel_type=ch.channel_type,
error_type="uncorrected",
).set(ch.uncorrected_errors)
metric_downstream_errors_legacy.labels(
channel=ch.channel_id,
channel_type=ch.channel_type,
error_type="corrected",
).set(ch.corrected_errors)
metric_downstream_errors_legacy.labels(
channel=ch.channel_id,
channel_type=ch.channel_type,
error_type="uncorrected",
).set(ch.uncorrected_errors)

match ch.channel_type:
case "sc_qam":
Expand Down

0 comments on commit 3498f4e

Please sign in to comment.