mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Add hostname-specific tag only if not already part of tags
This commit is contained in:
parent
b973e8ac9c
commit
0b343171a7
@ -281,7 +281,9 @@ func (r *metricRouter) Start() {
|
|||||||
// Foward message received from collector channel
|
// Foward message received from collector channel
|
||||||
coll_forward := func(p lp.CCMetric) {
|
coll_forward := func(p lp.CCMetric) {
|
||||||
// receive from metric collector
|
// receive from metric collector
|
||||||
p.AddTag(r.config.HostnameTagName, r.hostname)
|
if !p.HasTag(r.config.HostnameTagName) {
|
||||||
|
p.AddTag(r.config.HostnameTagName, r.hostname)
|
||||||
|
}
|
||||||
if r.config.IntervalStamp {
|
if r.config.IntervalStamp {
|
||||||
p.SetTime(r.timestamp)
|
p.SetTime(r.timestamp)
|
||||||
}
|
}
|
||||||
@ -310,7 +312,9 @@ func (r *metricRouter) Start() {
|
|||||||
cache_forward := func(p lp.CCMetric) {
|
cache_forward := func(p lp.CCMetric) {
|
||||||
// receive from metric collector
|
// receive from metric collector
|
||||||
if !r.dropMetric(p) {
|
if !r.dropMetric(p) {
|
||||||
p.AddTag(r.config.HostnameTagName, r.hostname)
|
if !p.HasTag(r.config.HostnameTagName) {
|
||||||
|
p.AddTag(r.config.HostnameTagName, r.hostname)
|
||||||
|
}
|
||||||
forward(p)
|
forward(p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user