Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use seconds as baseunit for duration metrics #6

Merged
merged 1 commit into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const gaugeNumSlicers = new Gauge({
});

const gaugeQueryDuration = new Gauge({
name: `${metricPrefix}_query_duration`,
help: 'Total time to complete the named query, in ms.',
name: `${metricPrefix}_query_duration_seconds`,
help: 'Total time to complete the named query, in seconds.',
labelNames: ['query_name', ...globalLabelNames],
registers: [metricsRegistry],
});
Expand Down
10 changes: 5 additions & 5 deletions src/teraslice-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class TerasliceStats implements TerasliceStatsInterface {

const NS_PER_SEC = 1e9;
const diff = process.hrtime(time);
this.queryDuration.executions = Math.round((diff[0] * NS_PER_SEC + diff[1]) / 1e6);
this.queryDuration.executions = (diff[0] * NS_PER_SEC + diff[1]) / 1e9;
}

// I think I've been doing this sort of thing wrong in the past.
Expand All @@ -105,10 +105,10 @@ export default class TerasliceStats implements TerasliceStatsInterface {
this.state = state.data;
await this.updateExecutions();

this.queryDuration.info = info.queryDuration;
this.queryDuration.jobs = jobs.queryDuration;
this.queryDuration.controllers = controllers.queryDuration;
this.queryDuration.state = state.queryDuration;
this.queryDuration.info = info.queryDuration / 1e3;
this.queryDuration.jobs = jobs.queryDuration / 1e3;
this.queryDuration.controllers = controllers.queryDuration / 1e3;
this.queryDuration.state = state.queryDuration / 1e3;
};
await run();
}
Expand Down