MCPcopy
hub / github.com/prometheus/client_js / metrics

Method metrics

lib/registry.js:83–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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) {

Callers 15

mainFunction · 0.95
histogram-3.jsFile · 0.80
histogram-1.jsFile · 0.80
runFunction · 0.80
histogram-2.jsFile · 0.80
histogram-4.jsFile · 0.80
default-metrics.jsFile · 0.80
mainFunction · 0.80
mainFunction · 0.80
server.jsFile · 0.80
addListenersFunction · 0.80
useGatewayFunction · 0.80

Calls 3

getMetricsAsArrayMethod · 0.95
getMetricsAsStringMethod · 0.95
standardizeCounterNameFunction · 0.85

Tested by

no test coverage detected