Merge branch 'metricstore' of github.com:ClusterCockpit/cc-backend into metricstore

This commit is contained in:
2025-09-09 15:04:33 +02:00
16 changed files with 35 additions and 132 deletions

View File

@@ -6,7 +6,7 @@ package avro
import (
"context"
"fmt"
"log"
"slices"
"strconv"
"sync"
@@ -35,7 +35,7 @@ func DataStaging(wg *sync.WaitGroup, ctx context.Context) {
// Fetch the frequency of the metric from the global configuration
freq, err := config.GetMetricFrequency(val.MetricName)
if err != nil {
fmt.Printf("Error fetching metric frequency: %s\n", err)
log.Printf("Error fetching metric frequency: %s\n", err)
continue
}
@@ -60,7 +60,7 @@ func DataStaging(wg *sync.WaitGroup, ctx context.Context) {
// If the Avro level is nil, create a new one
if avroLevel == nil {
fmt.Printf("Error creating or finding the level with cluster : %s, node : %s, metric : %s\n", val.Cluster, val.Node, val.MetricName)
log.Printf("Error creating or finding the level with cluster : %s, node : %s, metric : %s\n", val.Cluster, val.Node, val.MetricName)
}
oldSelector = slices.Clone(selector)
}

View File

@@ -2741,7 +2741,7 @@ input JobFilter {
startTime: TimeRange
state: [JobState!]
metricStats: [MetricStatItem!]
shared: StringInput
shared: String
node: StringInput
}
@@ -16490,7 +16490,7 @@ func (ec *executionContext) unmarshalInputJobFilter(ctx context.Context, obj any
it.MetricStats = data
case "shared":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("shared"))
data, err := ec.unmarshalOStringInput2ᚖgithubᚗcomᚋClusterCockpitᚋccᚑbackendᚋinternalᚋgraphᚋmodelᚐStringInput(ctx, v)
data, err := ec.unmarshalOString2ᚖstring(ctx, v)
if err != nil {
return it, err
}

View File

@@ -69,7 +69,7 @@ type JobFilter struct {
StartTime *config.TimeRange `json:"startTime,omitempty"`
State []schema.JobState `json:"state,omitempty"`
MetricStats []*MetricStatItem `json:"metricStats,omitempty"`
Shared *StringInput `json:"shared,omitempty"`
Shared *string `json:"shared,omitempty"`
Node *StringInput `json:"node,omitempty"`
}

View File

@@ -831,3 +831,15 @@ type mutationResolver struct{ *Resolver }
type nodeResolver struct{ *Resolver }
type queryResolver struct{ *Resolver }
type subClusterResolver struct{ *Resolver }
// !!! WARNING !!!
// The code below was going to be deleted when updating resolvers. It has been copied here so you have
// one last chance to move it out of harms way if you want. There are two reasons this happens:
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
// it when you're done.
// - You have helper methods in this file. Move them out to keep these resolver files clean.
/*
func (r *jobResolver) Exclusive(ctx context.Context, obj *schema.Job) (int, error) {
panic(fmt.Errorf("not implemented: Exclusive - exclusive"))
}
*/

View File

@@ -11,6 +11,7 @@ import (
"errors"
"fmt"
"io"
"log"
"os"
"path/filepath"
"sync"
@@ -26,7 +27,7 @@ func Archiving(wg *sync.WaitGroup, ctx context.Context) {
defer wg.Done()
d, err := time.ParseDuration(config.MetricStoreKeys.Archive.Interval)
if err != nil {
cclog.Fatalf("[METRICSTORE]> error parsing archive interval duration: %v\n", err)
log.Fatalf("[METRICSTORE]> error parsing archive interval duration: %v\n", err)
}
if d <= 0 {
return
@@ -44,14 +45,14 @@ func Archiving(wg *sync.WaitGroup, ctx context.Context) {
return
case <-ticks:
t := time.Now().Add(-d)
cclog.Infof("[METRICSTORE]> start archiving checkpoints (older than %s)...\n", t.Format(time.RFC3339))
log.Printf("[METRICSTORE]> start archiving checkpoints (older than %s)...\n", t.Format(time.RFC3339))
n, err := ArchiveCheckpoints(config.MetricStoreKeys.Checkpoints.RootDir,
config.MetricStoreKeys.Archive.RootDir, t.Unix(), config.MetricStoreKeys.Archive.DeleteInstead)
if err != nil {
cclog.Warnf("[METRICSTORE]> archiving failed: %s\n", err.Error())
log.Printf("[METRICSTORE]> archiving failed: %s\n", err.Error())
} else {
cclog.Infof("[METRICSTORE]> done: %d files zipped and moved to archive\n", n)
log.Printf("[METRICSTORE]> done: %d files zipped and moved to archive\n", n)
}
}
}

View File

@@ -34,7 +34,7 @@ func RegisterFootprintWorker() {
c := 0
ce := 0
cl := 0
cclog.Printf("Update Footprints started at %s", s.Format(time.RFC3339))
cclog.Printf("Update Footprints started at %s\n", s.Format(time.RFC3339))
for _, cluster := range archive.Clusters {
s_cluster := time.Now()