()
| 81 | } |
| 82 | |
| 83 | async metrics() { |
| 84 | const isOpenMetrics = |
| 85 | this.contentType === Registry.OPENMETRICS_CONTENT_TYPE; |
| 86 | |
| 87 | const promises = this.getMetricsAsArray().map(metric => { |
| 88 | if (isOpenMetrics && metric.type === 'counter') { |
| 89 | metric.name = standardizeCounterName(metric.name); |
| 90 | } |
| 91 | return this.getMetricsAsString(metric); |
| 92 | }); |
| 93 | |
| 94 | const resolves = await Promise.all(promises); |
| 95 | |
| 96 | return isOpenMetrics |
| 97 | ? `${resolves.join('\n')}\n# EOF\n` |
| 98 | : `${resolves.join('\n\n')}\n`; |
| 99 | } |
| 100 | |
| 101 | registerMetric(metric) { |
| 102 | if (this._metrics[metric.name] && this._metrics[metric.name] !== metric) { |
no test coverage detected