From 4a6fbee6c2b0b5c181f55c4621000d10dcc121ea Mon Sep 17 00:00:00 2001 From: Christopher Pappas Date: Tue, 28 Sep 2021 11:39:08 -0700 Subject: [PATCH] fix stitching logging --- src/config.ts | 2 ++ src/lib/stitching2/kaws/v2/stitching.ts | 13 +++++++------ .../middleware/responseLoggerMiddleware.ts | 6 ++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/config.ts b/src/config.ts index 9fb08f18f4..f930f46fda 100644 --- a/src/config.ts +++ b/src/config.ts @@ -62,6 +62,7 @@ const { IMPULSE_APPLICATION_ID, INTROSPECT_TOKEN, IP_BLACKLIST, + LOG_HTTP_LINKS, LOG_QUERY_DETAILS_THRESHOLD, MEMCACHED_MAX_POOL, MEMCACHED_URL, @@ -193,6 +194,7 @@ export default { IMPULSE_APPLICATION_ID, INTROSPECT_TOKEN, IP_BLACKLIST: IP_BLACKLIST || "", + LOG_HTTP_LINKS, LOG_QUERY_DETAILS_THRESHOLD, MEMCACHED_MAX_POOL: Number(MEMCACHED_MAX_POOL) || 10, MEMCACHED_URL: MEMCACHED_URL || "localhost:11211", diff --git a/src/lib/stitching2/kaws/v2/stitching.ts b/src/lib/stitching2/kaws/v2/stitching.ts index 346e0a1bcc..7276726677 100644 --- a/src/lib/stitching2/kaws/v2/stitching.ts +++ b/src/lib/stitching2/kaws/v2/stitching.ts @@ -44,6 +44,7 @@ export const kawsStitchingEnvironmentV2 = ( marketingCollections: { selectionSet: `{ internalID }`, resolve: ({ internalID: artistID }, args, context, info) => { + console.log("************************* resolving here!") return delegateToSchema({ schema: kawsSchema, operation: "query", @@ -152,12 +153,12 @@ export const kawsStitchingEnvironmentV2 = ( MarketingCollection: { artworksConnection: { fragment: ` - fragment MarketingCollectionQuery on MarketingCollection { - query { - ${Object.keys(filterArtworksArgs).join("\n")} - } - } - `, + fragment MarketingCollectionQuery on MarketingCollection { + query { + ${Object.keys(filterArtworksArgs).join("\n")} + } + } + `, resolve: (parent, _args, context, info) => { const query = parent.query const hasKeyword = Boolean(parent.query.keyword) diff --git a/src/lib/stitching2/middleware/responseLoggerMiddleware.ts b/src/lib/stitching2/middleware/responseLoggerMiddleware.ts index acb36a1ee8..e8028709b9 100644 --- a/src/lib/stitching2/middleware/responseLoggerMiddleware.ts +++ b/src/lib/stitching2/middleware/responseLoggerMiddleware.ts @@ -2,9 +2,11 @@ import { ExecutorMiddleware } from "lib/stitching2/lib/createRemoteExecutor" import extensionsLogger from "lib/loaders/api/extensionsLogger" import config from "config" +const { ENABLE_REQUEST_LOGGING, LOG_HTTP_LINKS } = config + const shouldLogLinkTraffic = - !!process.env.LOG_HTTP_LINKS && typeof jest === "undefined" -const { ENABLE_REQUEST_LOGGING } = config + LOG_HTTP_LINKS === "true" && typeof jest === "undefined" + const enableRequestLogging = ENABLE_REQUEST_LOGGING === "true" export const responseLoggerMiddleware = (name: string): ExecutorMiddleware => {