Extract stringReverse() function
This commit is contained in:
parent
ccca32d7b2
commit
565f423dd9
1 changed files with 5 additions and 3 deletions
|
@ -26,12 +26,14 @@ export class MetricsRenderer {
|
||||||
private metricName(name: string): string {
|
private metricName(name: string): string {
|
||||||
name = name.replace(/^(.*_)?(total)_(.*)$/, '$1$3_$2')
|
name = name.replace(/^(.*_)?(total)_(.*)$/, '$1$3_$2')
|
||||||
|
|
||||||
return sanitizePrometheusMetricName(
|
return sanitizePrometheusMetricName(stringReverse(stringReverse(this.prefix).replace(/^_+/, '')) + '_' + name)
|
||||||
this.prefix.split('').reverse().join('').replace(/^_+/, '').split('').reverse().join('') + '_' + name,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stringReverse(str: string): string {
|
||||||
|
return str.split('').reverse().join('')
|
||||||
|
}
|
||||||
|
|
||||||
const retryAfterWhileDiscovery = 15
|
const retryAfterWhileDiscovery = 15
|
||||||
const textContentType = 'text/plain; charset=utf-8'
|
const textContentType = 'text/plain; charset=utf-8'
|
||||||
const prometheusSpecVersion = '0.0.4'
|
const prometheusSpecVersion = '0.0.4'
|
||||||
|
|
Loading…
Reference in a new issue