Browse Source

Use more consistent argument names for various API functions.

pull/4/head
Fredrik Ekre 2 years ago
parent
commit
c34f7acab1
  1. 36
      src/Prometheus.jl

36
src/Prometheus.jl

@ -146,16 +146,16 @@ function metric_names(counter::Counter)
end 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`. `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 if v < 0
error("counting backwards") error("counting backwards")
end end
@atomic m.value += v @atomic counter.value += v
return nothing return nothing
end end
@ -222,44 +222,44 @@ function metric_names(gauge::Gauge)
end 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`. `v` defaults to `v = 1`.
""" """
function inc(m::Gauge, v = 1.0) function inc(gauge::Gauge, v = 1.0)
@atomic m.value += v @atomic gauge.value += v
return nothing return nothing
end 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`. `v` defaults to `v = 1`.
""" """
function dec(m::Gauge, v = 1.0) function dec(gauge::Gauge, v = 1.0)
@atomic m.value -= v @atomic gauge.value -= v
return nothing return nothing
end end
""" """
Prometheus.set(g::Gauge, v) Prometheus.set(gauge::Gauge, v)
Set the value of the gauge to `v`. Set the value of the gauge to `v`.
""" """
function set(m::Gauge, v) function set(gauge::Gauge, v)
@atomic m.value = v @atomic gauge.value = v
return nothing return nothing
end 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. Set the value of the gauge to the current unixtime in seconds.
""" """
function set_to_current_time(m::Gauge) function set_to_current_time(gauge::Gauge)
@atomic m.value = time() @atomic gauge.value = time()
return nothing return nothing
end end

Loading…
Cancel
Save