Skip to content

Commit

Permalink
feat(metrics): support request name on stats
Browse files Browse the repository at this point in the history
  • Loading branch information
enudler committed Sep 9, 2020
1 parent 2bec2c3 commit f1d109e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions lib/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ let uuid = require('uuid'),
CONFIG_PUSH_GATEWAY_URL: 'pushGatewayUrl',

// Defaults
DEFAULT_REQUEST_PHASES_DURATION_SECONDS: 'request_duration_seconds',
DEFAULT_CONNECTION_TIMINGS_SECONDS: 'connection_phases_seconds',
DEFAULT_REQUEST_DURATION_SECONDS: 'request_duration_seconds',
DEFAULT_REQUEST_WITH_PHASES_DURATION_SECONDS: 'request_with_phases_duration_seconds',
DEFAULT_RUNNER_STATS: 'runnerStats',
DEFAULT_MEASUREMENT_NAME: 'latency',
DEFAULT_ERROR_MEASUREMENT_NAME: 'clientErrors',
Expand Down Expand Up @@ -93,20 +93,21 @@ let uuid = require('uuid'),
return scriptConfig;
},
createPrometheusMeasurements: (config) => {
requestLatencyDuration = promClient.register.getSingleMetric(constants.DEFAULT_CONNECTION_TIMINGS_SECONDS) ||
requestLatencyDuration = promClient.register.getSingleMetric(constants.DEFAULT_REQUEST_DURATION_SECONDS) ||
new promClient.Histogram({
name: constants.DEFAULT_CONNECTION_TIMINGS_SECONDS,
help: 'Duration of connecti requests in seconds',
name: constants.DEFAULT_REQUEST_DURATION_SECONDS,
help: 'Duration of connection requests in seconds',
labelNames: ['path', 'status_code', 'request_name'],
buckets: config.bucketSizes || constants.DEFAULT_BUCKET_SIZE
});

requestPhaseDuration = new promClient.Histogram({
name: constants.DEFAULT_REQUEST_PHASES_DURATION_SECONDS,
help: 'Duration of phases in the request in seconds',
labelNames: ['path', 'status_code', 'phase', 'request_name'],
buckets: config.bucketSizes || constants.DEFAULT_BUCKET_SIZE
});
requestPhaseDuration = promClient.register.getSingleMetric(constants.DEFAULT_REQUEST_WITH_PHASES_DURATION_SECONDS) ||
new promClient.Histogram({
name: constants.DEFAULT_REQUEST_WITH_PHASES_DURATION_SECONDS,
help: 'Duration of phases in the request in seconds',
labelNames: ['path', 'status_code', 'phase', 'request_name'],
buckets: config.bucketSizes || constants.DEFAULT_BUCKET_SIZE
});

counterClientErrors = promClient.register.getSingleMetric(constants.DEFAULT_ERROR_MEASUREMENT_NAME) ||
new promClient.Counter({
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "artillery-plugin-prometheus",
"version": "1.3.1",
"version": "1.3.2",
"description": "Plugin for Artillery.IO that publishes response data into prometheus pushgateway.",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit f1d109e

Please sign in to comment.