@@ -6,10 +6,7 @@ import Dispatch
6
6
/// Prometheus Summary metric
7
7
///
8
8
/// See https://prometheus.io/docs/concepts/metric_types/#summary
9
- public class PromSummary < NumType: DoubleRepresentable > : PromMetric , PrometheusHandled {
10
- /// Prometheus instance that created this Summary
11
- internal weak var prometheus : PrometheusClient ?
12
-
9
+ public class PromSummary < NumType: DoubleRepresentable > : PromMetric {
13
10
/// Name of this Summary, required
14
11
public let name : String
15
12
/// Help text of this Summary, optional
@@ -49,17 +46,15 @@ public class PromSummary<NumType: DoubleRepresentable>: PromMetric, PrometheusHa
49
46
/// - capacity: Number of values to keep for calculating quantiles
50
47
/// - quantiles: Quantiles to use for the Summary
51
48
/// - p: Prometheus instance creating this Summary
52
- internal init ( _ name: String , _ help: String ? = nil , _ capacity: Int = Prometheus . defaultSummaryCapacity, _ quantiles: [ Double ] = Prometheus . defaultQuantiles, _ p : PrometheusClient ) {
49
+ internal init ( _ name: String , _ help: String ? = nil , _ capacity: Int = Prometheus . defaultSummaryCapacity, _ quantiles: [ Double ] = Prometheus . defaultQuantiles) {
53
50
self . name = name
54
51
self . help = help
55
52
56
- self . prometheus = p
57
-
58
53
self . displayUnit = nil
59
54
60
- self . sum = . init( " \( self . name) _sum " , nil , 0 , p )
55
+ self . sum = . init( " \( self . name) _sum " , nil , 0 )
61
56
62
- self . count = . init( " \( self . name) _count " , nil , 0 , p )
57
+ self . count = . init( " \( self . name) _count " , nil , 0 )
63
58
64
59
self . values = CircularBuffer ( initialCapacity: capacity)
65
60
@@ -197,10 +192,7 @@ public class PromSummary<NumType: DoubleRepresentable>: PromMetric, PrometheusHa
197
192
""" )
198
193
return summary
199
194
}
200
- guard let prometheus = prometheus else {
201
- fatalError ( " Lingering Summary " )
202
- }
203
- let newSummary = PromSummary ( self . name, self . help, self . capacity, self . quantiles, prometheus)
195
+ let newSummary = PromSummary ( self . name, self . help, self . capacity, self . quantiles)
204
196
self . subSummaries [ labels] = newSummary
205
197
return newSummary
206
198
}
0 commit comments