Initial commit for staging changes

This commit is contained in:
Aditya Ujeniya
2025-04-17 09:55:09 +02:00
parent e1c5ded933
commit b53832a055
6 changed files with 272 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ import (
"sync"
"time"
"github.com/ClusterCockpit/cc-metric-store/internal/avro"
"github.com/ClusterCockpit/cc-metric-store/internal/config"
"github.com/ClusterCockpit/cc-metric-store/internal/memorystore"
"github.com/ClusterCockpit/cc-metric-store/internal/util"
@@ -197,6 +198,8 @@ func decodeLine(dec *lineprotocol.Decoder,
var lvl *memorystore.Level = nil
prevCluster, prevHost := "", ""
var AvroBuf avro.AvroStruct
var ok bool
for dec.Next() {
rawmeasurement, err := dec.Measurement()
@@ -329,6 +332,17 @@ func decodeLine(dec *lineprotocol.Decoder,
return fmt.Errorf("host %s: timestamp : %#v with error : %#v", host, t, err.Error())
}
if config.Keys.Checkpoints.FileFormat != "json" {
AvroBuf.MetricName = string(metricBuf)
AvroBuf.Cluster = cluster
AvroBuf.Node = host
AvroBuf.Selector = selector
AvroBuf.Value = metric.Value
AvroBuf.Timestamp = t.Unix()
avro.LineProtocolMessages <- AvroBuf
}
if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {
return err
}