diff --git a/packages/metrics-prometheus/src/metric-group.ts b/packages/metrics-prometheus/src/metric-group.ts index 9909ffdd70..fc3cb6a496 100644 --- a/packages/metrics-prometheus/src/metric-group.ts +++ b/packages/metrics-prometheus/src/metric-group.ts @@ -72,7 +72,7 @@ export class PrometheusMetricGroup implements MetricGroup, CalculatedMetric { expect(reportedMetrics).to.include(`${metricName}{${metricLabel}="${metricKey1}"} ${metricValue1}`, 'did not include updated metric') expect(reportedMetrics).to.include(`${metricName}{${metricLabel}="${metricKey2}"} ${metricValue2}`, 'did not include updated metric') }) + + it('should allow grouped timers', async () => { + const metricName = randomMetricName() + const metricLabel = randomMetricName('label_') + const metricKey = randomMetricName('key_') + const metrics = prometheusMetrics()({ + logger: defaultLogger() + }) + const metric1 = metrics.registerMetricGroup(metricName, { + label: metricLabel + }) + + const timer = metric1.timer(metricKey) + + timer() + + const reportedMetrics = await client.register.metrics() + + expect(reportedMetrics).to.include(`${metricName}{${metricLabel}="${metricKey}"}`, 'did not include updated metric') + }) })