|
5 | 5 |
|
6 | 6 | package io.opentelemetry.contrib.jmxscraper.target_systems; |
7 | 7 |
|
8 | | -import static io.opentelemetry.contrib.jmxscraper.target_systems.MetricAssertions.assertGauge; |
9 | | -import static io.opentelemetry.contrib.jmxscraper.target_systems.MetricAssertions.assertSum; |
10 | | -import static io.opentelemetry.contrib.jmxscraper.target_systems.MetricAssertions.assertSumWithAttributes; |
11 | 8 | import static org.assertj.core.api.Assertions.entry; |
12 | 9 |
|
13 | 10 | import io.opentelemetry.contrib.jmxscraper.JmxScraperContainer; |
@@ -44,110 +41,74 @@ protected JmxScraperContainer customizeScraperContainer( |
44 | 41 | } |
45 | 42 |
|
46 | 43 | @Override |
47 | | - protected void verifyMetrics() { |
48 | | - waitAndAssertMetrics( |
49 | | - metric -> |
50 | | - assertGauge( |
51 | | - metric, |
52 | | - "cassandra.client.request.range_slice.latency.50p", |
53 | | - "Token range read request latency - 50th percentile", |
54 | | - "us"), |
55 | | - metric -> |
56 | | - assertGauge( |
57 | | - metric, |
58 | | - "cassandra.client.request.range_slice.latency.99p", |
59 | | - "Token range read request latency - 99th percentile", |
60 | | - "us"), |
61 | | - metric -> |
62 | | - assertGauge( |
63 | | - metric, |
64 | | - "cassandra.client.request.range_slice.latency.max", |
65 | | - "Maximum token range read request latency", |
66 | | - "us"), |
67 | | - metric -> |
68 | | - assertGauge( |
69 | | - metric, |
70 | | - "cassandra.client.request.read.latency.50p", |
71 | | - "Standard read request latency - 50th percentile", |
72 | | - "us"), |
73 | | - metric -> |
74 | | - assertGauge( |
75 | | - metric, |
76 | | - "cassandra.client.request.read.latency.99p", |
77 | | - "Standard read request latency - 99th percentile", |
78 | | - "us"), |
79 | | - metric -> |
80 | | - assertGauge( |
81 | | - metric, |
82 | | - "cassandra.client.request.read.latency.max", |
83 | | - "Maximum standard read request latency", |
84 | | - "us"), |
85 | | - metric -> |
86 | | - assertGauge( |
87 | | - metric, |
88 | | - "cassandra.client.request.write.latency.50p", |
89 | | - "Regular write request latency - 50th percentile", |
90 | | - "us"), |
91 | | - metric -> |
92 | | - assertGauge( |
93 | | - metric, |
94 | | - "cassandra.client.request.write.latency.99p", |
95 | | - "Regular write request latency - 99th percentile", |
96 | | - "us"), |
97 | | - metric -> |
98 | | - assertGauge( |
99 | | - metric, |
100 | | - "cassandra.client.request.write.latency.max", |
101 | | - "Maximum regular write request latency", |
102 | | - "us"), |
103 | | - metric -> |
104 | | - assertSum( |
105 | | - metric, |
106 | | - "cassandra.compaction.tasks.completed", |
107 | | - "Number of completed compactions since server [re]start", |
108 | | - "1"), |
109 | | - metric -> |
110 | | - assertGauge( |
111 | | - metric, |
112 | | - "cassandra.compaction.tasks.pending", |
113 | | - "Estimated number of compactions remaining to perform", |
114 | | - "1"), |
115 | | - metric -> |
116 | | - assertSum( |
117 | | - metric, |
118 | | - "cassandra.storage.load.count", |
119 | | - "Size of the on disk data size this node manages", |
120 | | - "by", |
121 | | - /* isMonotonic= */ false), |
122 | | - metric -> |
123 | | - assertSum( |
124 | | - metric, |
125 | | - "cassandra.storage.total_hints.count", |
126 | | - "Number of hint messages written to this node since [re]start", |
127 | | - "1"), |
128 | | - metric -> |
129 | | - assertSum( |
130 | | - metric, |
131 | | - "cassandra.storage.total_hints.in_progress.count", |
132 | | - "Number of hints attempting to be sent currently", |
133 | | - "1", |
134 | | - /* isMonotonic= */ false), |
135 | | - metric -> |
136 | | - assertSumWithAttributes( |
137 | | - metric, |
138 | | - "cassandra.client.request.count", |
139 | | - "Number of requests by operation", |
140 | | - "1", |
141 | | - attrs -> attrs.containsOnly(entry("operation", "RangeSlice")), |
142 | | - attrs -> attrs.containsOnly(entry("operation", "Read")), |
143 | | - attrs -> attrs.containsOnly(entry("operation", "Write"))), |
144 | | - metric -> |
145 | | - assertSumWithAttributes( |
146 | | - metric, |
147 | | - "cassandra.client.request.error.count", |
148 | | - "Number of request errors by operation", |
149 | | - "1", |
150 | | - getRequestErrorCountAttributes())); |
| 44 | + protected MetricsVerifier createMetricsVerifier() { |
| 45 | + return MetricsVerifier.create() |
| 46 | + .assertGauge( |
| 47 | + "cassandra.client.request.range_slice.latency.50p", |
| 48 | + "Token range read request latency - 50th percentile", |
| 49 | + "us") |
| 50 | + .assertGauge( |
| 51 | + "cassandra.client.request.range_slice.latency.99p", |
| 52 | + "Token range read request latency - 99th percentile", |
| 53 | + "us") |
| 54 | + .assertGauge( |
| 55 | + "cassandra.client.request.range_slice.latency.max", |
| 56 | + "Maximum token range read request latency", |
| 57 | + "us") |
| 58 | + .assertGauge( |
| 59 | + "cassandra.client.request.read.latency.50p", |
| 60 | + "Standard read request latency - 50th percentile", |
| 61 | + "us") |
| 62 | + .assertGauge( |
| 63 | + "cassandra.client.request.read.latency.99p", |
| 64 | + "Standard read request latency - 99th percentile", |
| 65 | + "us") |
| 66 | + .assertGauge( |
| 67 | + "cassandra.client.request.read.latency.max", |
| 68 | + "Maximum standard read request latency", |
| 69 | + "us") |
| 70 | + .assertGauge( |
| 71 | + "cassandra.client.request.write.latency.50p", |
| 72 | + "Regular write request latency - 50th percentile", |
| 73 | + "us") |
| 74 | + .assertGauge( |
| 75 | + "cassandra.client.request.write.latency.99p", |
| 76 | + "Regular write request latency - 99th percentile", |
| 77 | + "us") |
| 78 | + .assertGauge( |
| 79 | + "cassandra.client.request.write.latency.max", |
| 80 | + "Maximum regular write request latency", |
| 81 | + "us") |
| 82 | + .assertCounter( |
| 83 | + "cassandra.compaction.tasks.completed", |
| 84 | + "Number of completed compactions since server [re]start", |
| 85 | + "1") |
| 86 | + .assertGauge( |
| 87 | + "cassandra.compaction.tasks.pending", |
| 88 | + "Estimated number of compactions remaining to perform", |
| 89 | + "1") |
| 90 | + .assertUpDownCounter( |
| 91 | + "cassandra.storage.load.count", "Size of the on disk data size this node manages", "by") |
| 92 | + .assertCounter( |
| 93 | + "cassandra.storage.total_hints.count", |
| 94 | + "Number of hint messages written to this node since [re]start", |
| 95 | + "1") |
| 96 | + .assertUpDownCounter( |
| 97 | + "cassandra.storage.total_hints.in_progress.count", |
| 98 | + "Number of hints attempting to be sent currently", |
| 99 | + "1") |
| 100 | + .assertCounterWithAttributes( |
| 101 | + "cassandra.client.request.count", |
| 102 | + "Number of requests by operation", |
| 103 | + "1", |
| 104 | + attrs -> attrs.containsOnly(entry("operation", "RangeSlice")), |
| 105 | + attrs -> attrs.containsOnly(entry("operation", "Read")), |
| 106 | + attrs -> attrs.containsOnly(entry("operation", "Write"))) |
| 107 | + .assertCounterWithAttributes( |
| 108 | + "cassandra.client.request.error.count", |
| 109 | + "Number of request errors by operation", |
| 110 | + "1", |
| 111 | + getRequestErrorCountAttributes()); |
151 | 112 | } |
152 | 113 |
|
153 | 114 | @SuppressWarnings("unchecked") |
|
0 commit comments