format
This commit is contained in:
parent
da46fbb762
commit
9907101ff8
|
|
@ -137,18 +137,18 @@ private final class CachingMetricsHandler: MetricsHandler {
|
|||
}
|
||||
|
||||
public func makeCounter(label: String, dimensions: [(String, String)]) -> Counter {
|
||||
return counters.getOrSet(label: label, dimensions:dimensions, maker: self.wrapped.makeCounter)
|
||||
return self.counters.getOrSet(label: label, dimensions: dimensions, maker: self.wrapped.makeCounter)
|
||||
}
|
||||
|
||||
public func makeRecorder(label: String, dimensions: [(String, String)], aggregate: Bool) -> Recorder {
|
||||
let maker = { (label: String, dimensions: [(String, String)]) -> Recorder in
|
||||
self.wrapped.makeRecorder(label: label, dimensions: dimensions, aggregate: aggregate)
|
||||
}
|
||||
return recorders.getOrSet(label: label, dimensions:dimensions, maker: maker)
|
||||
return self.recorders.getOrSet(label: label, dimensions: dimensions, maker: maker)
|
||||
}
|
||||
|
||||
public func makeTimer(label: String, dimensions: [(String, String)]) -> Timer {
|
||||
return timers.getOrSet(label: label, dimensions:dimensions, maker: self.wrapped.makeTimer)
|
||||
return self.timers.getOrSet(label: label, dimensions: dimensions, maker: self.wrapped.makeTimer)
|
||||
}
|
||||
|
||||
private class Cache<T> {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class SimpleMetricsLibrary: MetricsHandler {
|
|||
}
|
||||
|
||||
func makeRecorder(label: String, dimensions: [(String, String)], aggregate: Bool) -> Recorder {
|
||||
let maker:(String, [(String, String)]) -> Recorder = aggregate ? ExampleRecorder.init : ExampleGauge.init
|
||||
let maker: (String, [(String, String)]) -> Recorder = aggregate ? ExampleRecorder.init : ExampleGauge.init
|
||||
return maker(label, dimensions)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,14 +246,14 @@ class MetricsTests: XCTestCase {
|
|||
XCTAssertNotEqual(counter3, counter, "expected caching to work with dimensions")
|
||||
// different dimensions "key"
|
||||
let name4 = name
|
||||
let dimensions4 = dimensions.map{ ($0.0 + "-test" , $0.1) }
|
||||
let dimensions4 = dimensions.map { ($0.0 + "-test", $0.1) }
|
||||
let counter4 = Metrics.global.makeCounter(label: name4, dimensions: dimensions4) as! TestCounter
|
||||
XCTAssertEqual(counter4.label, name4, "expected label to match")
|
||||
XCTAssertEqual(counter4.dimensions.description, dimensions4.description, "expected dimensions to match")
|
||||
XCTAssertNotEqual(counter4, counter, "expected caching to work with dimensions")
|
||||
// different dimensions "value"
|
||||
let name5 = name
|
||||
let dimensions5 = dimensions.map{ ($0.0, $0.1 + "-test") }
|
||||
let dimensions5 = dimensions.map { ($0.0, $0.1 + "-test") }
|
||||
let counter5 = Metrics.global.makeCounter(label: name5, dimensions: dimensions5) as! TestCounter
|
||||
XCTAssertEqual(counter5.label, name5, "expected label to match")
|
||||
XCTAssertEqual(counter5.dimensions.description, dimensions5.description, "expected dimensions to match")
|
||||
|
|
|
|||
Loading…
Reference in New Issue