mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
lib: consistently use regexp.Regexp.ReplaceAllLiteralString instead of regexp.Regexp.ReplaceAllString in places where the replacement cannot contain matching group placeholders
This commit is contained in:
parent
bdc0e688e8
commit
58a757cd01
@ -673,7 +673,7 @@ func SplitMetricNameToTokens(name string) []string {
|
||||
var nonAlphaNumChars = regexp.MustCompile(`[^a-zA-Z0-9]`)
|
||||
|
||||
var labelNameSanitizer = bytesutil.NewFastStringTransformer(func(s string) string {
|
||||
return unsupportedLabelNameChars.ReplaceAllString(s, "_")
|
||||
return unsupportedLabelNameChars.ReplaceAllLiteralString(s, "_")
|
||||
})
|
||||
|
||||
var unsupportedLabelNameChars = regexp.MustCompile(`[^a-zA-Z0-9_]`)
|
||||
@ -686,7 +686,7 @@ func SanitizeMetricName(value string) string {
|
||||
}
|
||||
|
||||
var metricNameSanitizer = bytesutil.NewFastStringTransformer(func(s string) string {
|
||||
return unsupportedMetricNameChars.ReplaceAllString(s, "_")
|
||||
return unsupportedMetricNameChars.ReplaceAllLiteralString(s, "_")
|
||||
})
|
||||
|
||||
var unsupportedMetricNameChars = regexp.MustCompile(`[^a-zA-Z0-9_:]`)
|
||||
|
@ -20,7 +20,7 @@ func SanitizeLabelName(name string) string {
|
||||
}
|
||||
|
||||
var labelNamesSanitizer = bytesutil.NewFastStringTransformer(func(s string) string {
|
||||
return invalidLabelCharRE.ReplaceAllString(s, "_")
|
||||
return invalidLabelCharRE.ReplaceAllLiteralString(s, "_")
|
||||
})
|
||||
|
||||
var invalidLabelCharRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)
|
||||
|
@ -44,9 +44,9 @@ func SanitizeName(name string) string {
|
||||
}
|
||||
|
||||
var namesSanitizer = bytesutil.NewFastStringTransformer(func(s string) string {
|
||||
s = unsupportedDatadogChars.ReplaceAllString(s, "_")
|
||||
s = multiUnderscores.ReplaceAllString(s, "_")
|
||||
s = underscoresWithDots.ReplaceAllString(s, ".")
|
||||
s = unsupportedDatadogChars.ReplaceAllLiteralString(s, "_")
|
||||
s = multiUnderscores.ReplaceAllLiteralString(s, "_")
|
||||
s = underscoresWithDots.ReplaceAllLiteralString(s, ".")
|
||||
return s
|
||||
})
|
||||
|
||||
|
@ -221,7 +221,7 @@ func areEqualTracesSkipDuration(s1, s2 string) bool {
|
||||
}
|
||||
|
||||
func zeroDurationsInTrace(s string) string {
|
||||
return skipDurationRe.ReplaceAllString(s, " 0ms: ")
|
||||
return skipDurationRe.ReplaceAllLiteralString(s, " 0ms: ")
|
||||
}
|
||||
|
||||
var skipDurationRe = regexp.MustCompile(" [0-9.]+ms: ")
|
||||
@ -233,7 +233,7 @@ func areEqualJSONTracesSkipDuration(s1, s2 string) bool {
|
||||
}
|
||||
|
||||
func zeroJSONDurationsInTrace(s string) string {
|
||||
return skipJSONDurationRe.ReplaceAllString(s, `"duration_msec":0`)
|
||||
return skipJSONDurationRe.ReplaceAllLiteralString(s, `"duration_msec":0`)
|
||||
}
|
||||
|
||||
var skipJSONDurationRe = regexp.MustCompile(`"duration_msec":[0-9.]+`)
|
||||
|
Loading…
Reference in New Issue
Block a user