Skip to content

Commit cb00e4a

Browse files
committed
Fixup tests & NIO version
1 parent 984e26d commit cb00e4a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
],
1212
dependencies: [
1313
.package(url: "https://github.com/apple/swift-metrics.git", from: "1.0.0"),
14-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
14+
.package(url: "https://github.com/apple/swift-nio.git", Version("1.0.0") ..< Version("3.0.0")),
1515
],
1616
targets: [
1717
.target(

Sources/Prometheus/MetricTypes/Histogram.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ extension PrometheusClient {
158158
if let histogram = histograms.first {
159159
return histogram
160160
} else {
161-
let histogram = PromHistogram<T, U>(histogram.name, histogram.help, labels, histogram.upperBounds, self)
162-
histogram.subHistograms.append(histogram)
163-
return histogram
161+
let newHistogram = PromHistogram<T, U>(histogram.name, histogram.help, labels, histogram.upperBounds, self)
162+
histogram.subHistograms.append(newHistogram)
163+
return newHistogram
164164
}
165165
}
166166
}

Sources/Prometheus/MetricTypes/Summary.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,18 @@ public class PromSummary<NumType: DoubleRepresentable, Labels: SummaryLabels>: P
148148

149149
extension PrometheusClient {
150150
/// Helper for summaries & labels
151-
fileprivate func getOrCreateSummary<T: Numeric, U: SummaryLabels>(withLabels labels: U, forSummary sum: PromSummary<T, U>) -> PromSummary<T, U> {
152-
let summaries = sum.subSummaries.filter { (metric) -> Bool in
153-
guard metric.name == sum.name, metric.help == sum.help, metric.labels == labels else { return false }
151+
fileprivate func getOrCreateSummary<T: Numeric, U: SummaryLabels>(withLabels labels: U, forSummary summary: PromSummary<T, U>) -> PromSummary<T, U> {
152+
let summaries = summary.subSummaries.filter { (metric) -> Bool in
153+
guard metric.name == summary.name, metric.help == summary.help, metric.labels == labels else { return false }
154154
return true
155155
}
156156
if summaries.count > 2 { fatalError("Somehow got 2 summaries with the same data type") }
157157
if let summary = summaries.first {
158158
return summary
159159
} else {
160-
let summary = PromSummary<T, U>(sum.name, sum.help, labels, sum.quantiles, self)
161-
sum.subSummaries.append(summary)
162-
return summary
160+
let newSummary = PromSummary<T, U>(summary.name, summary.help, labels, summary.quantiles, self)
161+
summary.subSummaries.append(newSummary)
162+
return newSummary
163163
}
164164
}
165165
}

Tests/SwiftPrometheusTests/PrometheusMetricsTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import XCTest
2+
@testable import Prometheus
23
@testable import CoreMetrics
34
@testable import PrometheusMetrics
45

0 commit comments

Comments
 (0)