Skip to content

Commit 3cf71ef

Browse files
committed
fix: PrometheusMetricsFactory deprecation via calling new internal func
Signed-off-by: Melissa Kilby <[email protected]>
1 parent d7c4a3e commit 3cf71ef

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Sources/Prometheus/PrometheusCollectorRegistry.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ public final class PrometheusCollectorRegistry: Sendable {
612612

613613
// MARK: - Private Implementation
614614

615-
private func _makeCounter(name: String, labels: [(String, String)], help: String) -> Counter {
615+
internal func _makeCounter(name: String, labels: [(String, String)], help: String) -> Counter {
616616
let name = name.ensureValidMetricName()
617617
let labels = labels.ensureValidLabelNames()
618618
let help = help.ensureValidHelpText()
@@ -674,7 +674,7 @@ public final class PrometheusCollectorRegistry: Sendable {
674674
}
675675
}
676676

677-
private func _makeGauge(name: String, labels: [(String, String)], help: String) -> Gauge {
677+
internal func _makeGauge(name: String, labels: [(String, String)], help: String) -> Gauge {
678678
let name = name.ensureValidMetricName()
679679
let labels = labels.ensureValidLabelNames()
680680
let help = help.ensureValidHelpText()
@@ -736,7 +736,7 @@ public final class PrometheusCollectorRegistry: Sendable {
736736
}
737737
}
738738

739-
private func _makeDurationHistogram(
739+
internal func _makeDurationHistogram(
740740
name: String,
741741
labels: [(String, String)],
742742
buckets: [Duration],
@@ -818,7 +818,7 @@ public final class PrometheusCollectorRegistry: Sendable {
818818
}
819819
}
820820

821-
private func _makeValueHistogram(
821+
internal func _makeValueHistogram(
822822
name: String,
823823
labels: [(String, String)],
824824
buckets: [Double],

Sources/Prometheus/PrometheusMetricsFactory.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ public struct PrometheusMetricsFactory: Sendable {
8888
extension PrometheusMetricsFactory: CoreMetrics.MetricsFactory {
8989
public func makeCounter(label: String, dimensions: [(String, String)]) -> CoreMetrics.CounterHandler {
9090
let (label, dimensions) = self.nameAndLabelSanitizer(label, dimensions)
91-
return self.registry.makeCounter(name: label, labels: dimensions)
91+
return self.registry._makeCounter(name: label, labels: dimensions, help: "")
9292
}
9393

9494
public func makeFloatingPointCounter(label: String, dimensions: [(String, String)]) -> FloatingPointCounterHandler {
9595
let (label, dimensions) = self.nameAndLabelSanitizer(label, dimensions)
96-
return self.registry.makeCounter(name: label, labels: dimensions)
96+
return self.registry._makeCounter(name: label, labels: dimensions, help: "")
9797
}
9898

9999
public func makeRecorder(
@@ -103,21 +103,21 @@ extension PrometheusMetricsFactory: CoreMetrics.MetricsFactory {
103103
) -> CoreMetrics.RecorderHandler {
104104
let (label, dimensions) = self.nameAndLabelSanitizer(label, dimensions)
105105
guard aggregate else {
106-
return self.registry.makeGauge(name: label, labels: dimensions)
106+
return self.registry._makeGauge(name: label, labels: dimensions, help: "")
107107
}
108108
let buckets = self.valueHistogramBuckets[label] ?? self.defaultValueHistogramBuckets
109-
return self.registry.makeValueHistogram(name: label, labels: dimensions, buckets: buckets)
109+
return self.registry._makeValueHistogram(name: label, labels: dimensions, buckets: buckets, help: "")
110110
}
111111

112112
public func makeMeter(label: String, dimensions: [(String, String)]) -> CoreMetrics.MeterHandler {
113113
let (label, dimensions) = self.nameAndLabelSanitizer(label, dimensions)
114-
return self.registry.makeGauge(name: label, labels: dimensions)
114+
return self.registry._makeGauge(name: label, labels: dimensions, help: "")
115115
}
116116

117117
public func makeTimer(label: String, dimensions: [(String, String)]) -> CoreMetrics.TimerHandler {
118118
let (label, dimensions) = self.nameAndLabelSanitizer(label, dimensions)
119119
let buckets = self.durationHistogramBuckets[label] ?? self.defaultDurationHistogramBuckets
120-
return self.registry.makeDurationHistogram(name: label, labels: dimensions, buckets: buckets)
120+
return self.registry._makeDurationHistogram(name: label, labels: dimensions, buckets: buckets, help: "")
121121
}
122122

123123
public func destroyCounter(_ handler: CoreMetrics.CounterHandler) {

0 commit comments

Comments
 (0)