diff --git a/api/schema.graphqls b/api/schema.graphqls index 8edae6c..d703990 100644 --- a/api/schema.graphqls +++ b/api/schema.graphqls @@ -194,7 +194,7 @@ type GlobalMetricListItem { name: String! unit: Unit! scope: MetricScope! - footprint: Boolean + footprint: String availability: [ClusterSupport!]! } diff --git a/internal/graph/generated/generated.go b/internal/graph/generated/generated.go index 91839a9..d54ddb1 100644 --- a/internal/graph/generated/generated.go +++ b/internal/graph/generated/generated.go @@ -2022,7 +2022,7 @@ type GlobalMetricListItem { name: String! unit: Unit! scope: MetricScope! - footprint: Boolean + footprint: String availability: [ClusterSupport!]! } @@ -3531,9 +3531,9 @@ func (ec *executionContext) _GlobalMetricListItem_footprint(ctx context.Context, if resTmp == nil { return graphql.Null } - res := resTmp.(bool) + res := resTmp.(string) fc.Result = res - return ec.marshalOBoolean2bool(ctx, field.Selections, res) + return ec.marshalOString2string(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_GlobalMetricListItem_footprint(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -3543,7 +3543,7 @@ func (ec *executionContext) fieldContext_GlobalMetricListItem_footprint(_ contex IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil diff --git a/internal/importer/testdata/cluster-fritz.json b/internal/importer/testdata/cluster-fritz.json index 8519fd4..e9f5e43 100644 --- a/internal/importer/testdata/cluster-fritz.json +++ b/internal/importer/testdata/cluster-fritz.json @@ -8,7 +8,7 @@ }, "scope": "node", "aggregation": "avg", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 72, "normal": 72, @@ -36,7 +36,7 @@ }, "scope": "node", "aggregation": "sum", - "footprint": true, + "footprint": "max", "timestep": 60, "peak": 256, "normal": 128, @@ -51,7 +51,7 @@ }, "scope": "hwthread", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 5600, "normal": 1000, @@ -94,7 +94,7 @@ }, "scope": "socket", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 350, "normal": 100, diff --git a/pkg/archive/clusterConfig.go b/pkg/archive/clusterConfig.go index a68a530..6f0178c 100644 --- a/pkg/archive/clusterConfig.go +++ b/pkg/archive/clusterConfig.go @@ -84,9 +84,9 @@ func initClusterConfig() error { newMetric.LowerIsBetter = cfg.LowerIsBetter sc.MetricConfig = append(sc.MetricConfig, *newMetric) - if newMetric.Footprint { + if newMetric.Footprint != "" { sc.Footprint = append(sc.Footprint, newMetric.Name) - ml.Footprint = true + ml.Footprint = newMetric.Footprint } if newMetric.Energy { sc.EnergyFootprint = append(sc.EnergyFootprint, newMetric.Name) @@ -96,7 +96,7 @@ func initClusterConfig() error { availability.SubClusters = append(availability.SubClusters, sc.Name) sc.MetricConfig = append(sc.MetricConfig, *newMetric) - if newMetric.Footprint { + if newMetric.Footprint != "" { sc.Footprint = append(sc.Footprint, newMetric.Name) } if newMetric.Energy { diff --git a/pkg/archive/testdata/archive/alex/cluster.json b/pkg/archive/testdata/archive/alex/cluster.json index fe791f4..cc2888d 100644 --- a/pkg/archive/testdata/archive/alex/cluster.json +++ b/pkg/archive/testdata/archive/alex/cluster.json @@ -8,7 +8,7 @@ }, "scope": "node", "aggregation": "avg", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 128, "normal": 128, @@ -36,7 +36,7 @@ }, "scope": "node", "aggregation": "sum", - "footprint": true, + "footprint": "max", "timestep": 60, "peak": 512, "normal": 128, @@ -51,7 +51,7 @@ }, "scope": "hwthread", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 9216, "normal": 1000, @@ -66,7 +66,7 @@ }, "scope": "socket", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 350, "normal": 100, @@ -108,7 +108,7 @@ }, "scope": "accelerator", "aggregation": "avg", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 100, "normal": 80, diff --git a/pkg/archive/testdata/archive/fritz/cluster.json b/pkg/archive/testdata/archive/fritz/cluster.json index b0263c4..58ec3af 100644 --- a/pkg/archive/testdata/archive/fritz/cluster.json +++ b/pkg/archive/testdata/archive/fritz/cluster.json @@ -8,7 +8,7 @@ }, "scope": "node", "aggregation": "avg", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 72, "normal": 72, @@ -20,7 +20,7 @@ "peak": 104, "normal": 104, "caution": 52, - "footprint": true, + "footprint": "avg", "alert": 20 }, { @@ -28,7 +28,7 @@ "peak": 104, "normal": 104, "caution": 52, - "footprint": true, + "footprint": "avg", "alert": 20 } ] @@ -54,7 +54,7 @@ }, "scope": "node", "aggregation": "sum", - "footprint": true, + "footprint": "max", "timestep": 60, "peak": 256, "normal": 128, @@ -67,7 +67,7 @@ "peak": 1024, "normal": 512, "caution": 900, - "footprint": true, + "footprint": "max", "lowerIsBetter": true, "alert": 1000 }, @@ -76,7 +76,7 @@ "peak": 2048, "normal": 1024, "caution": 1800, - "footprint": true, + "footprint": "max", "lowerIsBetter": true, "alert": 2000 } @@ -90,7 +90,7 @@ }, "scope": "hwthread", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 5600, "normal": 1000, @@ -103,7 +103,7 @@ "normal": 1500, "caution": 400, "alert": 50, - "footprint": true + "footprint": "avg" }, { "name": "spr2tb", @@ -187,7 +187,7 @@ }, "scope": "socket", "aggregation": "sum", - "footprint": true, + "footprint": "avg", "timestep": 60, "peak": 350, "normal": 100, diff --git a/pkg/schema/cluster.go b/pkg/schema/cluster.go index ef1be89..a77bd32 100644 --- a/pkg/schema/cluster.go +++ b/pkg/schema/cluster.go @@ -51,7 +51,7 @@ type SubClusterConfig struct { Normal float64 `json:"normal"` Caution float64 `json:"caution"` Alert float64 `json:"alert"` - Footprint bool `json:"footprint"` + Footprint string `json:"footprint,omitempty"` Remove bool `json:"remove"` LowerIsBetter bool `json:"lowerIsBetter"` Energy bool `json:"energy"` @@ -69,7 +69,7 @@ type MetricConfig struct { Caution float64 `json:"caution"` Alert float64 `json:"alert"` LowerIsBetter bool `json:"lowerIsBetter"` - Footprint bool `json:"footprint"` + Footprint string `json:"footprint,omitempty"` Energy bool `json:"energy"` } @@ -88,7 +88,7 @@ type GlobalMetricListItem struct { Name string `json:"name"` Unit Unit `json:"unit"` Scope MetricScope `json:"scope"` - Footprint bool `json:"footprint"` + Footprint string `json:"footprint,omitempty"` Availability []ClusterSupport `json:"availability"` }