mirror of
https://github.com/ClusterCockpit/cc-metric-store.git
synced 2024-12-27 09:19:06 +01:00
Add unit to buffers
This commit is contained in:
parent
e71e1b123b
commit
5e5586f319
4
api.go
4
api.go
@ -183,7 +183,7 @@ type ApiQueryRequest struct {
|
||||
From int64 `json:"from"`
|
||||
To int64 `json:"to"`
|
||||
WithStats bool `json:"with-stats"`
|
||||
WithUnit bool `json:"with-unit"`
|
||||
WithUnit bool `json:"with-unit,omitempty"`
|
||||
WithData bool `json:"with-data"`
|
||||
WithPadding bool `json:"with-padding"`
|
||||
Queries []ApiQuery `json:"queries"`
|
||||
@ -303,7 +303,7 @@ func handleQuery(rw http.ResponseWriter, r *http.Request) {
|
||||
if req.WithPadding {
|
||||
data.PadDataWithNull(req.From, req.To, query.Metric)
|
||||
}
|
||||
if req.WithUnit {
|
||||
if req.WithUnit && len(unit) > 0 {
|
||||
data.Unit = unit
|
||||
}
|
||||
if !req.WithData {
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
type CheckpointMetrics struct {
|
||||
Frequency int64 `json:"frequency"`
|
||||
Start int64 `json:"start"`
|
||||
Unit string `json:"unit"`
|
||||
Unit string `json:"unit,omitempty"`
|
||||
Data []Float `json:"data"`
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ func (l *level) loadFile(cf *CheckpointFile, m *MemoryStore) error {
|
||||
frequency: metric.Frequency,
|
||||
start: metric.Start,
|
||||
data: metric.Data[0:n:n], // Space is wasted here :(
|
||||
unit: "",
|
||||
unit: metric.Unit,
|
||||
prev: nil,
|
||||
next: nil,
|
||||
archived: true,
|
||||
|
Loading…
Reference in New Issue
Block a user