@@ -6,111 +6,111 @@ let myProm = PrometheusClient()
66
77MetricsSystem . bootstrap ( PrometheusMetricsFactory ( client: myProm) )
88
9- for _ in 0 ... Int . random ( in: 10 ... 100 ) {
10- let c = Counter ( label: " test " )
11- c. increment ( )
12- }
9+ // for _ in 0...Int.random(in: 10...100) {
10+ // let c = Counter(label: "test")
11+ // c.increment()
12+ // }
1313
1414for _ in 0 ... Int . random ( in: 10 ... 100 ) {
1515 let c = Counter ( label: " test " , dimensions: [ ( " abc " , " 123 " ) ] )
1616 c. increment ( )
1717}
1818
19- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
20- let r = Recorder ( label: " recorder " )
21- r. record ( Double . random ( in: 0 ... 20 ) )
22- }
23-
24- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
25- let g = Gauge ( label: " non_agg_recorder " )
26- g. record ( Double . random ( in: 0 ... 20 ) )
27- }
28-
29- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
30- let t = Timer ( label: " timer " )
31- t. recordMicroseconds ( Double . random ( in: 20 ... 150 ) )
32- }
33-
34- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
35- let r = Recorder ( label: " recorder " , dimensions: [ ( " abc " , " 123 " ) ] )
36- r. record ( Double . random ( in: 0 ... 20 ) )
37- }
38-
39- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
40- let g = Gauge ( label: " non_agg_recorder " , dimensions: [ ( " abc " , " 123 " ) ] )
41- g. record ( Double . random ( in: 0 ... 20 ) )
42- }
43-
44- for _ in 0 ... Int . random ( in: 100 ... 500_000 ) {
45- let t = Timer ( label: " timer " , dimensions: [ ( " abc " , " 123 " ) ] )
46- t. recordMicroseconds ( Double . random ( in: 20 ... 150 ) )
47- }
48-
49-
50- struct MyCodable : MetricLabels {
51- var thing : String = " * "
52- }
53-
54- let codable1 = MyCodable ( thing: " Thing1 " )
55- let codable2 = MyCodable ( thing: " Thing2 " )
56-
57- let counter = myProm. createCounter ( forType: Int . self, named: " my_counter " , helpText: " Just a counter " , initialValue: 12 , withLabelType: MyCodable . self)
58-
59- counter. inc ( 5 )
60- counter. inc ( Int . random ( in: 0 ... 100 ) , codable2)
61- counter. inc ( Int . random ( in: 0 ... 100 ) , codable1)
62-
63- let gauge = myProm. createGauge ( forType: Int . self, named: " my_gauge " , helpText: " Just a gauge " , initialValue: 12 , withLabelType: MyCodable . self)
64-
65- gauge. inc ( 100 )
66- gauge. inc ( Int . random ( in: 0 ... 100 ) , codable2)
67- gauge. inc ( Int . random ( in: 0 ... 100 ) , codable1)
68-
69- struct HistogramThing : HistogramLabels {
70- var le : String = " "
71- let route : String
72-
73- init ( ) {
74- self . route = " * "
75- }
76-
77- init ( _ route: String ) {
78- self . route = route
79- }
80- }
81-
82- let histogram = myProm. createHistogram ( forType: Double . self, named: " my_histogram " , helpText: " Just a histogram " , labels: HistogramThing . self)
83-
84- for _ in 0 ... Int . random ( in: 10 ... 50 ) {
85- histogram. observe ( Double . random ( in: 0 ... 1 ) )
86- }
87-
88- for _ in 0 ... Int . random ( in: 10 ... 50 ) {
89- histogram. observe ( Double . random ( in: 0 ... 1 ) , HistogramThing ( " /test " ) )
90- }
91-
92- struct SummaryThing : SummaryLabels {
93- var quantile : String = " "
94- let route : String
95-
96- init ( ) {
97- self . route = " * "
98- }
99-
100- init ( _ route: String ) {
101- self . route = route
102- }
103- }
104-
105- let summary = myProm. createSummary ( forType: Double . self, named: " my_summary " , helpText: " Just a summary " , labels: SummaryThing . self)
106-
107- for _ in 0 ... Int . random ( in: 100 ... 1000 ) {
108- summary. observe ( Double . random ( in: 0 ... 10000 ) )
109- }
110-
111- for _ in 0 ... Int . random ( in: 100 ... 1000 ) {
112- summary. observe ( Double . random ( in: 0 ... 10000 ) , SummaryThing ( " /test " ) )
113- }
19+ // for _ in 0...Int.random(in: 100...500_000) {
20+ // let r = Recorder(label: "recorder")
21+ // r.record(Double.random(in: 0...20))
22+ // }
23+ //
24+ // for _ in 0...Int.random(in: 100...500_000) {
25+ // let g = Gauge(label: "non_agg_recorder")
26+ // g.record(Double.random(in: 0...20))
27+ // }
28+ //
29+ // for _ in 0...Int.random(in: 100...500_000) {
30+ // let t = Timer(label: "timer")
31+ // t.recordMicroseconds(Double.random(in: 20...150))
32+ // }
33+ //
34+ // for _ in 0...Int.random(in: 100...500_000) {
35+ // let r = Recorder(label: "recorder", dimensions: [("abc", "123")])
36+ // r.record(Double.random(in: 0...20))
37+ // }
38+ //
39+ // for _ in 0...Int.random(in: 100...500_000) {
40+ // let g = Gauge(label: "non_agg_recorder", dimensions: [("abc", "123")])
41+ // g.record(Double.random(in: 0...20))
42+ // }
43+ //
44+ // for _ in 0...Int.random(in: 100...500_000) {
45+ // let t = Timer(label: "timer", dimensions: [("abc", "123")])
46+ // t.recordMicroseconds(Double.random(in: 20...150))
47+ // }
48+
49+
50+ // struct MyCodable: MetricLabels {
51+ // var thing: String = "*"
52+ // }
53+ //
54+ // let codable1 = MyCodable(thing: "Thing1")
55+ // let codable2 = MyCodable(thing: "Thing2")
56+ //
57+ // let counter = myProm.createCounter(forType: Int.self, named: "my_counter", helpText: "Just a counter", initialValue: 12, withLabelType: MyCodable.self)
58+ //
59+ // counter.inc(5)
60+ // counter.inc(Int.random(in: 0...100), codable2)
61+ // counter.inc(Int.random(in: 0...100), codable1)
62+ //
63+ // let gauge = myProm.createGauge(forType: Int.self, named: "my_gauge", helpText: "Just a gauge", initialValue: 12, withLabelType: MyCodable.self)
64+ //
65+ // gauge.inc(100)
66+ // gauge.inc(Int.random(in: 0...100), codable2)
67+ // gauge.inc(Int.random(in: 0...100), codable1)
68+ //
69+ // struct HistogramThing: HistogramLabels {
70+ // var le: String = ""
71+ // let route: String
72+ //
73+ // init() {
74+ // self.route = "*"
75+ // }
76+ //
77+ // init(_ route: String) {
78+ // self.route = route
79+ // }
80+ // }
81+ //
82+ // let histogram = myProm.createHistogram(forType: Double.self, named: "my_histogram", helpText: "Just a histogram", labels: HistogramThing.self)
83+ //
84+ // for _ in 0...Int.random(in: 10...50) {
85+ // histogram.observe(Double.random(in: 0...1))
86+ // }
87+ //
88+ // for _ in 0...Int.random(in: 10...50) {
89+ // histogram.observe(Double.random(in: 0...1), HistogramThing("/test"))
90+ // }
91+ //
92+ // struct SummaryThing: SummaryLabels {
93+ // var quantile: String = ""
94+ // let route: String
95+ //
96+ // init() {
97+ // self.route = "*"
98+ // }
99+ //
100+ // init(_ route: String) {
101+ // self.route = route
102+ // }
103+ // }
104+ //
105+ // let summary = myProm.createSummary(forType: Double.self, named: "my_summary", helpText: "Just a summary", labels: SummaryThing.self)
106+ //
107+ // for _ in 0...Int.random(in: 100...1000) {
108+ // summary.observe(Double.random(in: 0...10000))
109+ // }
110+ //
111+ // for _ in 0...Int.random(in: 100...1000) {
112+ // summary.observe(Double.random(in: 0...10000), SummaryThing("/test"))
113+ // }
114114
115115let elg = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
116116let prom = elg. next ( ) . makePromise ( of: String . self)
0 commit comments