diff --git a/Sources/Prometheus/MetricTypes/Counter.swift b/Sources/Prometheus/MetricTypes/Counter.swift index 04f833e..97d5468 100644 --- a/Sources/Prometheus/MetricTypes/Counter.swift +++ b/Sources/Prometheus/MetricTypes/Counter.swift @@ -73,10 +73,11 @@ public class Counter: Metric, Prometheus var val = self.metrics[labels] ?? self.initialValue val += amount self.metrics[labels] = val + done(val) } else { self.value += amount + done(self.value) } - done(self.value) } } diff --git a/Sources/Prometheus/MetricTypes/Gauge.swift b/Sources/Prometheus/MetricTypes/Gauge.swift index a96eabf..0757387 100644 --- a/Sources/Prometheus/MetricTypes/Gauge.swift +++ b/Sources/Prometheus/MetricTypes/Gauge.swift @@ -109,9 +109,7 @@ public class Gauge: Metric, PrometheusHa /// - done: Completion handler /// public func inc(_ labels: Labels? = nil, _ done: @escaping (NumType) -> Void = { _ in }) { - self.inc(1, labels) { value in - done(value) - } + self.inc(1, labels, done) } /// Decrements the Gauge @@ -141,9 +139,7 @@ public class Gauge: Metric, PrometheusHa /// - labels: Labels to attach to the value /// public func dec(_ labels: Labels? = nil, _ done: @escaping (NumType) -> Void = { _ in }) { - self.dec(1, labels) { value in - done(value) - } + self.dec(1, labels, done) } /// Gets the value of the Gauge diff --git a/Sources/Prometheus/MetricTypes/Summary.swift b/Sources/Prometheus/MetricTypes/Summary.swift index e8edca9..a02f26e 100644 --- a/Sources/Prometheus/MetricTypes/Summary.swift +++ b/Sources/Prometheus/MetricTypes/Summary.swift @@ -1,5 +1,3 @@ -import Dispatch - /// Default quantiles used by Summaries public var defaultQuantiles = [0.01, 0.05, 0.5, 0.9, 0.95, 0.99, 0.999]