Skip to content

Commit

Permalink
Review fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasumoto committed Apr 16, 2019
1 parent b6fd495 commit 20e7fc7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Sources/Prometheus/MetricTypes/Counter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ public class Counter<NumType: Numeric, Labels: MetricLabels>: 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)
}
}

Expand Down
8 changes: 2 additions & 6 deletions Sources/Prometheus/MetricTypes/Gauge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ public class Gauge<NumType: Numeric, Labels: MetricLabels>: 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
Expand Down Expand Up @@ -141,9 +139,7 @@ public class Gauge<NumType: Numeric, Labels: MetricLabels>: 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
Expand Down
2 changes: 0 additions & 2 deletions Sources/Prometheus/MetricTypes/Summary.swift
Original file line number Diff line number Diff line change
@@ -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]

Expand Down

0 comments on commit 20e7fc7

Please sign in to comment.