mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 15:29:04 +01:00
Allow other fields not only field "value"
This commit is contained in:
parent
3f4b11db47
commit
64ffa3d23e
@ -43,23 +43,24 @@ func (s *HttpSink) Write(m lp.CCMetric) error {
|
||||
p := m.ToPoint(s.meta_as_tags)
|
||||
s.lock.Lock()
|
||||
firstWriteOfBatch = len(s.encoder.Bytes()) == 0
|
||||
v, ok := m.GetField("value")
|
||||
if ok {
|
||||
|
||||
s.encoder.StartLine(p.Name())
|
||||
for _, v := range p.TagList() {
|
||||
s.encoder.AddTag(v.Key, v.Value)
|
||||
}
|
||||
|
||||
s.encoder.AddField("value", influx.MustNewValue(v))
|
||||
for _, v := range p.FieldList() {
|
||||
s.encoder.AddField(v.Key, influx.MustNewValue(v.Value))
|
||||
}
|
||||
s.encoder.EndLine(p.Time())
|
||||
|
||||
err = s.encoder.Err()
|
||||
if err != nil {
|
||||
cclog.ComponentError(s.name, "encoding failed:", err.Error())
|
||||
s.lock.Unlock()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
s.lock.Unlock()
|
||||
|
||||
if s.flushDelay == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user