prometheus: metadata: simplify the metrics-metadata format (#39411)

* prometheus: metadata: simplify the metrics-metadata format

* fixed unit test

* fixed tests
This commit is contained in:
Gábor Farkas
2021-09-21 15:19:52 +02:00
committed by GitHub
parent f1edd0ea08
commit 346a53145c
8 changed files with 66 additions and 66 deletions

View File

@@ -40,7 +40,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: Promet
counterNameMetric =
metricMetadataKeys.find((metricName) => {
// Only considering first type information, could be non-deterministic
const metadata = metricsMetadata[metricName][0];
const metadata = metricsMetadata[metricName];
if (metadata.type.toLowerCase() === 'counter') {
const metricRegex = new RegExp(`\\b${metricName}\\b`);
if (query.match(metricRegex)) {