From a1cc2182536b558431052f10355d61f63e96df8c Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Fri, 4 Aug 2023 14:05:12 +0000 Subject: [PATCH 1/2] Added debug logging for all queries produced --- cmd/submitplan.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/submitplan.go b/cmd/submitplan.go index 9c700353..1995abc0 100644 --- a/cmd/submitplan.go +++ b/cmd/submitplan.go @@ -160,14 +160,23 @@ func changingItemQueriesFromPlan(ctx context.Context, planJSON []byte, lf log.Fi } u := uuid.New() - changing_items = append(changing_items, &sdp.Query{ + newQuery := sdp.Query{ Type: mapData.Type, Method: mapData.Method, Query: query.(string), Scope: scope, RecursionBehaviour: &sdp.Query_RecursionBehaviour{}, UUID: u[:], - }) + } + + changing_items = append(changing_items, &newQuery) + + log.WithContext(ctx).WithFields(log.Fields{ + "scope": newQuery.Scope, + "type": newQuery.Type, + "query": newQuery.Query, + "method": newQuery.Method.String(), + }).Debug("mapped terraform to query") } } From fc1590b94a2acb1e4095c6e556ea25a7884448e1 Mon Sep 17 00:00:00 2001 From: Dylan Ratcliffe Date: Fri, 4 Aug 2023 14:07:26 +0000 Subject: [PATCH 2/2] Removed "unauthenticated" Gives the wrong impression --- cmd/auth_client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/auth_client.go b/cmd/auth_client.go index 3f22b993..adec33e8 100644 --- a/cmd/auth_client.go +++ b/cmd/auth_client.go @@ -21,7 +21,7 @@ func AuthenticatedApiKeyClient(ctx context.Context) sdpconnect.ApiKeyServiceClie url = viper.GetString("url") viper.Set("api-key-url", url) } - log.WithContext(ctx).WithField("api-key-url", url).Debug("Connecting to overmind apikeys API") + log.WithContext(ctx).WithField("api-key-url", url).Debug("Connecting to overmind apikeys API (pre-authenticated)") return sdpconnect.NewApiKeyServiceClient(httpClient, url) } @@ -33,7 +33,7 @@ func UnauthenticatedApiKeyClient(ctx context.Context) sdpconnect.ApiKeyServiceCl url = viper.GetString("url") viper.Set("api-key-url", url) } - log.WithContext(ctx).WithField("api-key-url", url).Debug("Connecting to overmind apikeys API (unauthenticated)") + log.WithContext(ctx).WithField("api-key-url", url).Debug("Connecting to overmind apikeys API") return sdpconnect.NewApiKeyServiceClient(otelhttp.DefaultClient, url) }