Prometheus wants counter, not count

This commit is contained in:
Lars Strojny 2022-11-07 22:41:52 +01:00
parent 7fd1c5a03c
commit e338c982d2
2 changed files with 2 additions and 2 deletions

View file

@ -50,7 +50,7 @@ export class MetricsRenderer {
render(metric: Metric): string {
const name = this.metricName(metric.name)
return [
`# TYPE ${name} ${name.endsWith('_total') ? 'count' : 'gauge'}`,
`# TYPE ${name} ${name.endsWith('_total') ? 'counter' : 'gauge'}`,
`${name}${this.renderLabels(metric.labels)} ${metric.value}${
metric.timestamp !== null ? ' ' + String(metric.timestamp.getTime()) : ''
}`,

View file

@ -37,7 +37,7 @@ prefix_metric{label="Some Label"} 0.000001 946684800000`,
new Metric(metricName, 42, new Date('2000-01-01 00:00:00 UTC'), { label: 'Some Label' }),
),
).toEqual(
`# TYPE prefix_some_metric_total count
`# TYPE prefix_some_metric_total counter
prefix_some_metric_total{label="Some Label"} 42 946684800000`,
)
}