Skip to content

Commit 9820bbd

Browse files
committed
Cleanup
1 parent 3b78712 commit 9820bbd

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

Sources/Prometheus/MetricTypes/Counter.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public class Counter<NumType: Numeric, Labels: MetricLabels>: Metric {
2-
public internal(set) var name: String
3-
public internal(set) var help: String?
2+
public let name: String
3+
public let help: String?
44

55
internal var value: NumType
66

@@ -12,10 +12,6 @@ public class Counter<NumType: Numeric, Labels: MetricLabels>: Metric {
1212
self.value = initialValue
1313
}
1414

15-
internal func getMetrics(_ hideType: Bool = true) -> String {
16-
return self.getMetric().replacingOccurrences(of: "# TYPE \(name) counter\n", with: "")
17-
}
18-
1915
public func getMetric() -> String {
2016
var output = [String]()
2117

Sources/Prometheus/MetricTypes/Gauge.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
public class Gauge<NumType: Numeric, Labels: MetricLabels>: Metric {
2-
public internal(set) var name: String
3-
public internal(set) var help: String?
2+
public let name: String
3+
public let help: String?
44

5-
internal var value: NumType
5+
private var value: NumType
66

7-
internal var metrics: [Labels: NumType] = [:]
7+
private var metrics: [Labels: NumType] = [:]
88

99
public init(_ name: String, _ help: String? = nil, _ initialValue: NumType = 0) {
1010
self.name = name

Sources/Prometheus/MetricTypes/Histogram.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ extension HistogramLabels {
1212
}
1313

1414
public class Histogram<NumType: DoubleRepresentable, Labels: HistogramLabels>: Metric {
15-
public var name: String
15+
public let name: String
1616

17-
public var help: String?
17+
public let help: String?
1818

1919
private var buckets: [Counter<NumType, EmptyCodable>] = []
2020

2121
private var upperBounds: [Double]
2222

23-
public var labels: Labels
23+
private var labels: Labels
2424

25-
private var total: Counter<NumType, EmptyCodable>
25+
private let total: Counter<NumType, EmptyCodable>
2626

2727
internal init(_ name: String, _ help: String? = nil, _ labels: Labels = Labels(), _ buckets: [Double] = defaultBuckets) {
2828
self.name = name

Sources/Prometheus/MetricTypes/Summary.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ extension SummaryLabels {
1212
}
1313

1414
public class Summary<NumType: DoubleRepresentable, Labels: SummaryLabels>: Metric {
15-
public var name: String
15+
public let name: String
1616

17-
public var help: String?
17+
public let help: String?
1818

19-
public var labels: Labels
19+
private var labels: Labels
2020

21-
private var sum: Counter<NumType, EmptyCodable>
21+
private let sum: Counter<NumType, EmptyCodable>
2222

23-
private var count: Counter<NumType, EmptyCodable>
23+
private let count: Counter<NumType, EmptyCodable>
2424

2525
private var values: [NumType] = []
2626

2727
private var quantiles: [Double]
2828

29-
public init(_ name: String, _ help: String? = nil, _ quantiles: [Double] = defaultQuantiles, _ labels: Labels = Labels()) {
29+
internal init(_ name: String, _ help: String? = nil, _ quantiles: [Double] = defaultQuantiles, _ labels: Labels = Labels()) {
3030
self.name = name
3131
self.help = help
3232

0 commit comments

Comments
 (0)