From c34f7acab14029cae04d4fa75535d3be749648f9 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Sat, 4 Nov 2023 16:22:36 +0100 Subject: [PATCH] Use more consistent argument names for various API functions. --- src/Prometheus.jl | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Prometheus.jl b/src/Prometheus.jl index 6fb28c5..ceea9f3 100644 --- a/src/Prometheus.jl +++ b/src/Prometheus.jl @@ -146,16 +146,16 @@ function metric_names(counter::Counter) end """ - Prometheus.inc(c::Counter, v = 1) + Prometheus.inc(counter::Counter, v = 1) -Increment the value of the counter `c` with `v`. +Increment the value of the counter with `v`. `v` must be non-negative, and defaults to `v = 1`. """ -function inc(m::Counter, v = 1.0) +function inc(counter::Counter, v = 1.0) if v < 0 error("counting backwards") end - @atomic m.value += v + @atomic counter.value += v return nothing end @@ -222,44 +222,44 @@ function metric_names(gauge::Gauge) end """ - Prometheus.inc(g::Gauge, v = 1) + Prometheus.inc(gauge::Gauge, v = 1) -Increment the value of the gauge `g` with `v`. +Increment the value of the gauge with `v`. `v` defaults to `v = 1`. """ -function inc(m::Gauge, v = 1.0) - @atomic m.value += v +function inc(gauge::Gauge, v = 1.0) + @atomic gauge.value += v return nothing end """ - Prometheus.dec(g::Gauge, v = 1) + Prometheus.dec(gauge::Gauge, v = 1) -Decrement the value of the gauge `g` with `v`. +Decrement the value of the gauge with `v`. `v` defaults to `v = 1`. """ -function dec(m::Gauge, v = 1.0) - @atomic m.value -= v +function dec(gauge::Gauge, v = 1.0) + @atomic gauge.value -= v return nothing end """ - Prometheus.set(g::Gauge, v) + Prometheus.set(gauge::Gauge, v) Set the value of the gauge to `v`. """ -function set(m::Gauge, v) - @atomic m.value = v +function set(gauge::Gauge, v) + @atomic gauge.value = v return nothing end """ - Prometheus.set_to_current_time(g::Gauge) + Prometheus.set_to_current_time(gauge::Gauge) Set the value of the gauge to the current unixtime in seconds. """ -function set_to_current_time(m::Gauge) - @atomic m.value = time() +function set_to_current_time(gauge::Gauge) + @atomic gauge.value = time() return nothing end