Merge in refactored branch

This commit is contained in:
2024-06-18 07:13:56 +02:00
9 changed files with 768 additions and 103 deletions

View File

@@ -23,10 +23,10 @@ import (
)
type ApiMetricData struct {
Error *string `json:"error,omitempty"`
Error *string `json:"error,omitempty"`
Data util.FloatArray `json:"data,omitempty"`
From int64 `json:"from"`
To int64 `json:"to"`
From int64 `json:"from"`
To int64 `json:"to"`
Avg util.Float `json:"avg"`
Min util.Float `json:"min"`
Max util.Float `json:"max"`
@@ -180,10 +180,10 @@ type ApiQueryResponse struct {
type ApiQuery struct {
Type *string `json:"type,omitempty"`
SubType *string `json:"subtype,omitempty"`
Metric string `json:"metric"`
Hostname string `json:"host"`
TypeIds []string `json:"type-ids,omitempty"`
SubTypeIds []string `json:"subtype-ids,omitempty"`
Metric string `json:"metric"`
Hostname string `json:"host"`
TypeIds []string `json:"type-ids,omitempty"`
SubTypeIds []string `json:"subtype-ids,omitempty"`
ScaleFactor util.Float `json:"scale-by,omitempty"`
Aggregate bool `json:"aggreg"`
}
@@ -310,13 +310,13 @@ func handleDebug(rw http.ResponseWriter, r *http.Request) {
selector := []string{}
if len(raw) != 0 {
selector = strings.Split(raw, ":")
}
}
ms := memorystore.GetMemoryStore()
if err := ms.DebugDump(bufio.NewWriter(rw), selector); err != nil {
rw.WriteHeader(http.StatusBadRequest)
rw.Write([]byte(err.Error()))
}
}
}
func StartApiServer(ctx context.Context, httpConfig *config.HttpConfig) error {