fix(added-backticks): added backticks for hyphen (#8644)

* fix(added-backticks): added backticks for hyphen also

* Update pkg/query-service/utils/format.go

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
aniketio-ctrl 2025-07-29 15:19:28 +05:30 committed by GitHub
parent c17241272f
commit 360285ef33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -245,8 +245,8 @@ func ClickHouseFormattedMetricNames(v interface{}) string {
}
func AddBackTickToFormatTag(str string) string {
if strings.Contains(str, ".") {
return "`" + str + "`"
if strings.Contains(str, ".") || strings.Contains(str, "-") {
if strings.HasPrefix(str, "`") && strings.HasSuffix(str, "`") { return str } else { return "`" + str + "`" }
} else {
return str
}