Remove WithUnit query option

This commit is contained in:
Jan Eitzinger 2023-08-22 17:05:23 +02:00
parent eb5b22e3d5
commit 26335a2216
2 changed files with 7 additions and 16 deletions

7
api.go
View File

@ -283,9 +283,7 @@ func handleQuery(rw http.ResponseWriter, r *http.Request) {
res := make([]ApiMetricData, 0, len(sels)) res := make([]ApiMetricData, 0, len(sels))
for _, sel := range sels { for _, sel := range sels {
data := ApiMetricData{} data := ApiMetricData{}
data.Unit = "" data.Data, data.From, data.To, data.Unit, err = memoryStore.Read(sel, query.Metric, req.From, req.To)
unit := ""
data.Data, data.From, data.To, unit, err = memoryStore.Read(sel, query.Metric, req.From, req.To)
// log.Printf("data: %#v, %#v, %#v, %#v", data.Data, data.From, data.To, err) // log.Printf("data: %#v, %#v, %#v, %#v", data.Data, data.From, data.To, err)
if err != nil { if err != nil {
msg := err.Error() msg := err.Error()
@ -303,9 +301,6 @@ func handleQuery(rw http.ResponseWriter, r *http.Request) {
if req.WithPadding { if req.WithPadding {
data.PadDataWithNull(req.From, req.To, query.Metric) data.PadDataWithNull(req.From, req.To, query.Metric)
} }
if req.WithUnit && len(unit) > 0 {
data.Unit = unit
}
if !req.WithData { if !req.WithData {
data.Data = nil data.Data = nil
} }

View File

@ -1,27 +1,23 @@
{ {
"metrics": { "metrics": {
"cpi": { "frequency": 15, "aggregation": "avg" },
"flops_any": { "frequency": 15, "aggregation": "sum" }, "flops_any": { "frequency": 15, "aggregation": "sum" },
"flops_dp": { "frequency": 15, "aggregation": "sum" }, "flops_dp": { "frequency": 15, "aggregation": "sum" },
"flops_sp": { "frequency": 15, "aggregation": "sum" }, "flops_sp": { "frequency": 15, "aggregation": "sum" }
"mem_bw": { "frequency": 15, "aggregation": "sum" },
"load_one": { "frequency": 15, "aggregation": null },
"load_five": { "frequency": 15, "aggregation": null }
}, },
"checkpoints": { "checkpoints": {
"interval": "12h", "interval": "12h",
"directory": "./var/checkpoints", "directory": "./testdata/checkpoints",
"restore": "48h" "restore": "48h"
}, },
"archive": { "archive": {
"interval": "168h", "interval": "168h",
"directory": "./var/archive" "directory": "./testdata/archive"
}, },
"http-api": { "http-api": {
"address": "0.0.0.0:8081", "address": "127.0.0.1:8081",
"https-cert-file": null, "https-cert-file": null,
"https-key-file": null "https-key-file": null
}, },
"retention-in-memory": "48h", "retention-in-memory": "48h"
"nats": null,
"jwt-public-key": "kzfYrYy+TzpanWZHJ5qSdMj5uKUWgq74BWhQG6copP0="
} }