Lines 76-81
Link Here
|
76 |
private static final String METRIC_AVG = "avg="; |
76 |
private static final String METRIC_AVG = "avg="; |
77 |
|
77 |
|
78 |
private static final String METRIC_HIT = "hit="; |
78 |
private static final String METRIC_HIT = "hit="; |
|
|
79 |
private static final String METRIC_SENT_BYTES = "sb="; |
80 |
private static final String METRIC_RECEIVED_BYTES = "rb="; |
79 |
private static final String METRIC_PCT_PREFIX = "pct"; |
81 |
private static final String METRIC_PCT_PREFIX = "pct"; |
80 |
|
82 |
|
81 |
private static final String METRIC_MAX_ACTIVE_THREADS = "maxAT="; |
83 |
private static final String METRIC_MAX_ACTIVE_THREADS = "maxAT="; |
Lines 180-192
Link Here
|
180 |
*/ |
182 |
*/ |
181 |
private void addMetrics(String transaction, SamplerMetric metric) { |
183 |
private void addMetrics(String transaction, SamplerMetric metric) { |
182 |
// FOR ALL STATUS |
184 |
// FOR ALL STATUS |
183 |
addMetric(transaction, metric.getTotal(), TAG_ALL, metric.getAllMean(), metric.getAllMinTime(), |
185 |
addMetric(transaction, metric.getTotal(), metric.getSentBytes(), metric.getReceivedBytes(), TAG_ALL, metric.getAllMean(), metric.getAllMinTime(), |
184 |
metric.getAllMaxTime(), allPercentiles.values(), metric::getAllPercentile); |
186 |
metric.getAllMaxTime(), allPercentiles.values(), metric::getAllPercentile); |
185 |
// FOR OK STATUS |
187 |
// FOR OK STATUS |
186 |
addMetric(transaction, metric.getSuccesses(), TAG_OK, metric.getOkMean(), metric.getOkMinTime(), |
188 |
addMetric(transaction, metric.getSuccesses(), null, null, TAG_OK, metric.getOkMean(), metric.getOkMinTime(), |
187 |
metric.getOkMaxTime(), okPercentiles.values(), metric::getOkPercentile); |
189 |
metric.getOkMaxTime(), okPercentiles.values(), metric::getOkPercentile); |
188 |
// FOR KO STATUS |
190 |
// FOR KO STATUS |
189 |
addMetric(transaction, metric.getFailures(), TAG_KO, metric.getKoMean(), metric.getKoMinTime(), |
191 |
addMetric(transaction, metric.getFailures(), null, null, TAG_KO, metric.getKoMean(), metric.getKoMinTime(), |
190 |
metric.getKoMaxTime(), koPercentiles.values(), metric::getKoPercentile); |
192 |
metric.getKoMaxTime(), koPercentiles.values(), metric::getKoPercentile); |
191 |
|
193 |
|
192 |
metric.getErrors().forEach((error, count) -> addErrorMetric(transaction, error.getResponseCode(), |
194 |
metric.getErrors().forEach((error, count) -> addErrorMetric(transaction, error.getResponseCode(), |
Lines 209-218
Link Here
|
209 |
} |
211 |
} |
210 |
|
212 |
|
211 |
private void addMetric(String transaction, int count, |
213 |
private void addMetric(String transaction, int count, |
|
|
214 |
Long sentBytes, Long receivedBytes, |
212 |
String statut, double mean, double minTime, double maxTime, |
215 |
String statut, double mean, double minTime, double maxTime, |
213 |
Collection<Float> pcts, PercentileProvider percentileProvider) { |
216 |
Collection<Float> pcts, PercentileProvider percentileProvider) { |
214 |
if (count > 0) { |
217 |
if (count > 0) { |
215 |
StringBuilder tag = new StringBuilder(70); |
218 |
StringBuilder tag = new StringBuilder(95); |
216 |
tag.append(TAG_APPLICATION).append(application); |
219 |
tag.append(TAG_APPLICATION).append(application); |
217 |
tag.append(TAG_STATUS).append(statut); |
220 |
tag.append(TAG_STATUS).append(statut); |
218 |
tag.append(TAG_TRANSACTION).append(transaction); |
221 |
tag.append(TAG_TRANSACTION).append(transaction); |
Lines 229-234
Link Here
|
229 |
if (!Double.isNaN(maxTime)) { |
232 |
if (!Double.isNaN(maxTime)) { |
230 |
field.append(',').append(METRIC_MAX).append(maxTime); |
233 |
field.append(',').append(METRIC_MAX).append(maxTime); |
231 |
} |
234 |
} |
|
|
235 |
if(sentBytes != null) { |
236 |
field.append(',').append(METRIC_SENT_BYTES).append(sentBytes); |
237 |
} |
238 |
if(receivedBytes != null) { |
239 |
field.append(',').append(METRIC_RECEIVED_BYTES).append(receivedBytes); |
240 |
} |
232 |
for (Float pct : pcts) { |
241 |
for (Float pct : pcts) { |
233 |
field.append(',').append(METRIC_PCT_PREFIX).append(pct).append('=').append( |
242 |
field.append(',').append(METRIC_PCT_PREFIX).append(pct).append('=').append( |
234 |
percentileProvider.getPercentileValue(pct)); |
243 |
percentileProvider.getPercentileValue(pct)); |
Lines 262-271
Link Here
|
262 |
} |
271 |
} |
263 |
|
272 |
|
264 |
field.append(',').append(METRIC_HIT).append(metric.getHits()); |
273 |
field.append(',').append(METRIC_HIT).append(metric.getHits()); |
|
|
274 |
field.append(',').append(METRIC_SENT_BYTES).append(metric.getSentBytes()); |
275 |
field.append(',').append(METRIC_RECEIVED_BYTES).append(metric.getReceivedBytes()); |
265 |
for (Float pct : pcts) { |
276 |
for (Float pct : pcts) { |
266 |
field.append(',').append(METRIC_PCT_PREFIX).append(pct).append('=').append(Double.toString(metric.getAllPercentile(pct))); |
277 |
field.append(',').append(METRIC_PCT_PREFIX).append(pct).append('=').append(Double.toString(metric.getAllPercentile(pct))); |
267 |
} |
278 |
} |
268 |
field.append(',').append(METRIC_HIT).append(metric.getHits()); |
|
|
269 |
influxdbMetricsManager.addMetric(measurement, tag.toString(), field.toString()); |
279 |
influxdbMetricsManager.addMetric(measurement, tag.toString(), field.toString()); |
270 |
} |
280 |
} |
271 |
} |
281 |
} |