diff --git a/src/prometheus.ts b/src/prometheus.ts index d9e618a..e54270b 100644 --- a/src/prometheus.ts +++ b/src/prometheus.ts @@ -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()) : '' }`, diff --git a/tests/prometheus.test.ts b/tests/prometheus.test.ts index 79d8e2f..88a8d3c 100644 --- a/tests/prometheus.test.ts +++ b/tests/prometheus.test.ts @@ -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`, ) }