From 4d49698e5aab94a57c616c3da5d078ae2aacf0d7 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Fri, 24 Mar 2023 14:43:37 +0100 Subject: [PATCH] Add scope to GraphQL Metric Type --- api/schema.graphqls | 1 + internal/graph/model/models_gen.go | 1 + internal/graph/schema.resolvers.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/schema.graphqls b/api/schema.graphqls index 76c805d..41a50df 100644 --- a/api/schema.graphqls +++ b/api/schema.graphqls @@ -108,6 +108,7 @@ type Resource { type JobMetricWithName { name: String! + scope: MetricScope! metric: JobMetric! } diff --git a/internal/graph/model/models_gen.go b/internal/graph/model/models_gen.go index d27d517..03e0d46 100644 --- a/internal/graph/model/models_gen.go +++ b/internal/graph/model/models_gen.go @@ -59,6 +59,7 @@ type JobFilter struct { type JobMetricWithName struct { Name string `json:"name"` + Scope schema.MetricScope `json:"scope"` Metric *schema.JobMetric `json:"metric"` } diff --git a/internal/graph/schema.resolvers.go b/internal/graph/schema.resolvers.go index 8831cb1..718f331 100644 --- a/internal/graph/schema.resolvers.go +++ b/internal/graph/schema.resolvers.go @@ -173,9 +173,10 @@ func (r *queryResolver) JobMetrics(ctx context.Context, id string, metrics []str res := []*model.JobMetricWithName{} for name, md := range data { - for _, metric := range md { + for scope, metric := range md { res = append(res, &model.JobMetricWithName{ Name: name, + Scope: scope, Metric: metric, }) }