Skip to content

Commit 1a821d8

Browse files
committed
Fix some formatting issues
1 parent 5513bbe commit 1a821d8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Sources/Prometheus/MetricTypes/Counter.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public class Counter<NumType: Numeric, Labels: MetricLabels>: Metric, Prometheus
2525

2626
output.append(headers)
2727

28-
output.append("\(name) \(value)")
28+
if value != initialValue && initialValue == 0 {
29+
output.append("\(name) \(value)")
30+
}
2931

3032
metrics.forEach { (labels, value) in
3133
let labelsString = encodeLabels(labels)

Sources/Prometheus/MetricTypes/Gauge.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public class Gauge<NumType: Numeric, Labels: MetricLabels>: Metric, PrometheusHa
2525

2626
output.append(headers)
2727

28-
output.append("\(name) \(value)")
28+
if value != initialValue && initialValue == 0 {
29+
output.append("\(name) \(value)")
30+
}
2931

3032
metrics.forEach { (labels, value) in
3133
let labelsString = encodeLabels(labels)

0 commit comments

Comments
 (0)