Skip to content

Commit

Permalink
Skipped metric data older than 24 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
mex committed Jan 27, 2020
1 parent c9b7a38 commit f7f889b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ class MetricRegistry {
}
async logMetrics() {
const metrics = await this.getMetrics()

const result = []
for (const metric of metrics) {
if (Date.now() - metric.endTime > 24 * 60 * 60 * 1000) {
// Skip data points more than 24 hours old
continue
}
result.push(this.convertTimestampToIsoString(metric))
}
statistic(`Metric dump`, {
metrics: metrics.map(this.convertTimestampToIsoString)
metrics: result
})
}
async getMetrics() {
Expand Down

0 comments on commit f7f889b

Please sign in to comment.