Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Merge pull request #6 from terascope/ms
Browse files Browse the repository at this point in the history
use seconds as baseunit for duration metrics
  • Loading branch information
godber authored Nov 21, 2020
2 parents e215c41 + 2b70386 commit ccab5d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit ccab5d3

Please sign in to comment.