File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
Sources/Exporters/Prometheus Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,13 @@ public class PrometheusExporter: MetricExporter {
3535
3636 public func export( metrics: [ MetricData ] ) -> ExportResult {
3737 metricsLock. withLockVoid {
38- self . metrics. append ( contentsOf : metrics)
38+ self . metrics = metrics
3939 }
4040 return . success
4141 }
4242
43- public func getAndClearMetrics ( ) -> [ MetricData ] {
43+ public func getMetrics ( ) -> [ MetricData ] {
4444 defer {
45- metrics = [ MetricData] ( )
4645 metricsLock. unlock ( )
4746 }
4847 metricsLock. lock ( )
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public enum PrometheusExporterExtensions {
2323
2424 public static func writeMetricsCollection( exporter: PrometheusExporter ) -> String {
2525 var output = " "
26- let metrics = exporter. getAndClearMetrics ( )
26+ let metrics = exporter. getMetrics ( )
2727 let now = String ( Int64 ( ( Date ( ) . timeIntervalSince1970 * 1000.0 ) . rounded ( ) ) )
2828
2929 metrics. forEach { metric in
You can’t perform that action at this time.
0 commit comments