From 4554b8eea676f39fb251fa4b6b90590d345ae2f5 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Fri, 18 Jan 2019 16:09:00 +0900 Subject: [PATCH] Align proposal code with proposal README, add missing make* on Metrics (#5) May resolve #4 if that was the original intent of using the API --- Sources/CoreMetrics/Metrics.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sources/CoreMetrics/Metrics.swift b/Sources/CoreMetrics/Metrics.swift index 84d677f..3fddd6d 100644 --- a/Sources/CoreMetrics/Metrics.swift +++ b/Sources/CoreMetrics/Metrics.swift @@ -118,6 +118,21 @@ public enum Metrics { } } +public extension Metrics { + @inlinable + func makeCounter(label: String, dimensions: [(String, String)]) -> Counter { + return Metrics.global.makeCounter(label: label, dimensions: dimensions) + } + @inlinable + func makeRecorder(label: String, dimensions: [(String, String)], aggregate: Bool) -> Recorder { + return Metrics.global.makeRecorder(label: label, dimensions: dimensions, aggregate: aggregate) + } + @inlinable + func makeTimer(label: String, dimensions: [(String, String)]) -> Timer { + return Metrics.global.makeTimer(label: label, dimensions: dimensions) + } +} + private final class CachingMetricsHandler: MetricsHandler { private let wrapped: MetricsHandler private var counters = Cache()