Port logging to cclog, use loglevels
Separate REST API from pkg API
This commit is contained in:
2025-10-19 09:33:40 +02:00
parent 047b997a22
commit 67be9aa27b
10 changed files with 268 additions and 301 deletions

View File

@@ -6,12 +6,7 @@
package memorystore
import (
"bytes"
"encoding/json"
"fmt"
"github.com/ClusterCockpit/cc-backend/internal/config"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
)
var InternalCCMSFlag bool = false
@@ -93,17 +88,6 @@ type MetricConfig struct {
var Metrics map[string]MetricConfig
func InitMetricStore(rawConfig json.RawMessage) {
if rawConfig != nil {
config.Validate(configSchema, rawConfig)
dec := json.NewDecoder(bytes.NewReader(rawConfig))
// dec.DisallowUnknownFields()
if err := dec.Decode(&Keys); err != nil {
cclog.Abortf("[METRICSTORE]> Metric Store Config Init: Could not decode config file '%s'.\nError: %s\n", rawConfig, err.Error())
}
}
}
func GetMetricFrequency(metricName string) (int64, error) {
if metric, ok := Metrics[metricName]; ok {
return metric.Frequency, nil