mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-09-16 05:24:30 +02:00
Meta to tags list and map for sinks (#63)
* Change ccMetric->Influx functions * Use a meta_as_tags string list in config but create a lookup map afterwards * Add meta as tag logic to sampleSink
This commit is contained in:
@@ -53,7 +53,7 @@ func (s *HttpSink) Write(m lp.CCMetric) error {
|
||||
})
|
||||
}
|
||||
|
||||
p := m.ToPoint(s.config.MetaAsTags)
|
||||
p := m.ToPoint(s.meta_as_tags)
|
||||
|
||||
s.lock.Lock()
|
||||
_, err := s.encoder.Encode(p)
|
||||
@@ -159,6 +159,11 @@ func NewHttpSink(name string, config json.RawMessage) (Sink, error) {
|
||||
s.flushDelay = t
|
||||
}
|
||||
}
|
||||
// Create lookup map to use meta infos as tags in the output metric
|
||||
s.meta_as_tags = make(map[string]bool)
|
||||
for _, k := range s.config.MetaAsTags {
|
||||
s.meta_as_tags[k] = true
|
||||
}
|
||||
tr := &http.Transport{
|
||||
MaxIdleConns: s.maxIdleConns,
|
||||
IdleConnTimeout: s.idleConnTimeout,
|
||||
|
Reference in New Issue
Block a user