Remove metricData usage

Is replaced by builtin memorystore API
This commit is contained in:
2025-12-21 13:29:43 +01:00
parent d23f20f42a
commit 50df63a2d2
15 changed files with 116 additions and 126 deletions

View File

@@ -11,8 +11,8 @@ import (
"time"
"github.com/ClusterCockpit/cc-backend/internal/config"
"github.com/ClusterCockpit/cc-backend/internal/metricdata"
"github.com/ClusterCockpit/cc-backend/internal/memorystore"
"github.com/ClusterCockpit/cc-backend/internal/metricdata"
"github.com/ClusterCockpit/cc-backend/pkg/archive"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
@@ -36,7 +36,6 @@ func RegisterMetricPullWorker() {
// Register one worker per cluster
registered := 0
for _, cluster := range config.Clusters {
cluster := cluster // capture for closure
_, err := s.NewJob(
gocron.DurationJob(d),
@@ -83,10 +82,10 @@ func pullMetricsForCluster(clusterName string) error {
to := time.Now()
from := to.Add(-60 * time.Minute)
// 5. Get upstream backend repository (from separate config)
upstreamRepo, err := metricdata.GetUpstreamMetricDataRepo(clusterName)
// 5. Get upstream backend repository (from global config)
upstreamRepo, err := metricdata.GetUpstreamMetricDataRepo()
if err != nil {
cclog.Debugf("No upstream repository configured for cluster %s, skipping pull", clusterName)
cclog.Debugf("No upstream repository configured, skipping pull for cluster %s", clusterName)
return nil
}

View File

@@ -116,10 +116,11 @@ func Start(cronCfg, archiveConfig json.RawMessage) {
RegisterLdapSyncService(lc.SyncInterval)
}
RegisterMetricPullWorker()
RegisterFootprintWorker()
RegisterUpdateDurationWorker()
RegisterCommitJobService()
RegisterMetricPullWorker()
s.Start()
}
@@ -127,6 +128,8 @@ func Start(cronCfg, archiveConfig json.RawMessage) {
// Shutdown stops the task manager and its scheduler.
func Shutdown() {
if s != nil {
s.Shutdown()
if err := s.Shutdown(); err != nil {
cclog.Errorf("taskmanager Shutdown: error stopping scheduler: %v", err)
}
}
}

View File

@@ -10,7 +10,7 @@ import (
"math"
"time"
"github.com/ClusterCockpit/cc-backend/internal/metricdata"
"github.com/ClusterCockpit/cc-backend/internal/memorystore"
"github.com/ClusterCockpit/cc-backend/pkg/archive"
cclog "github.com/ClusterCockpit/cc-lib/ccLogger"
"github.com/ClusterCockpit/cc-lib/schema"
@@ -58,12 +58,6 @@ func RegisterFootprintWorker() {
allMetrics = append(allMetrics, mc.Name)
}
repo, err := metricdata.GetMetricDataRepo(cluster.Name)
if err != nil {
cclog.Errorf("no metric data repository configured for '%s'", cluster.Name)
continue
}
pendingStatements := []sq.UpdateBuilder{}
for _, job := range jobs {
@@ -72,7 +66,7 @@ func RegisterFootprintWorker() {
sJob := time.Now()
jobStats, err := repo.LoadStats(job, allMetrics, context.Background())
jobStats, err := memorystore.LoadStats(job, allMetrics, context.Background())
if err != nil {
cclog.Errorf("error wile loading job data stats for footprint update: %v", err)
ce++