delete tag if tagvalue is -

This commit is contained in:
Ulric Qin 2022-04-28 12:29:55 +08:00
parent 1860337c47
commit 7b70e7ae0b
2 changed files with 4 additions and 1 deletions

View File

@ -17,7 +17,7 @@
# interval_times = 1
# important! use global unique string to specify instance
# labels = { instance="192.168.1.2:8080", service="tomcat" }
# labels = { instance="192.168.1.2:8080", url="-" }
## Optional TLS Config
# use_tls = false

View File

@ -37,6 +37,9 @@ func NewSample(metric string, value interface{}, labels ...map[string]string) *t
for i := 0; i < len(labels); i++ {
for k, v := range labels[i] {
if v == "-" {
continue
}
s.Labels[k] = v
}
}