diff --git a/.changeset/@graphql-hive_gateway-664-dependencies.md b/.changeset/@graphql-hive_gateway-664-dependencies.md deleted file mode 100644 index 6f6fd476c5..0000000000 --- a/.changeset/@graphql-hive_gateway-664-dependencies.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@graphql-hive/gateway': patch ---- - -dependencies updates: - -- Updated dependency [`@graphql-mesh/cache-upstash-redis@^0.0.4` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cache-upstash-redis/v/0.0.4) (from `^0.0.3`, in `dependencies`) diff --git a/packages/gateway/CHANGELOG.md b/packages/gateway/CHANGELOG.md index 68c4ea1c86..a5220bf346 100644 --- a/packages/gateway/CHANGELOG.md +++ b/packages/gateway/CHANGELOG.md @@ -1,5 +1,13 @@ # @graphql-hive/gateway +## 1.10.3 + +### Patch Changes + +- [#664](https://github.com/graphql-hive/gateway/pull/664) [`b4d4760`](https://github.com/graphql-hive/gateway/commit/b4d4760861f360bed0e1566a50833164678fe3d5) Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates: + + - Updated dependency [`@graphql-mesh/cache-upstash-redis@^0.0.4` ↗︎](https://www.npmjs.com/package/@graphql-mesh/cache-upstash-redis/v/0.0.4) (from `^0.0.3`, in `dependencies`) + ## 1.10.2 ### Patch Changes diff --git a/packages/gateway/package.json b/packages/gateway/package.json index 13b91d7695..334084da8a 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-hive/gateway", - "version": "1.10.2", + "version": "1.10.3", "type": "module", "repository": { "type": "git", diff --git a/packages/runtime/package.json b/packages/runtime/package.json index e3d7f736ab..374fe7d25a 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-hive/gateway-runtime", - "version": "1.4.15", + "version": "1.4.16", "type": "module", "repository": { "type": "git", diff --git a/packages/runtime/src/plugins/useDelegationPlanDebug.ts b/packages/runtime/src/plugins/useDelegationPlanDebug.ts index 7d7684cd22..df91692434 100644 --- a/packages/runtime/src/plugins/useDelegationPlanDebug.ts +++ b/packages/runtime/src/plugins/useDelegationPlanDebug.ts @@ -14,7 +14,6 @@ export function useDelegationPlanDebug< fetchAPI = yoga.fetchAPI; }, onDelegationPlan({ - subgraph, typeName, variables, fragments, @@ -23,13 +22,10 @@ export function useDelegationPlanDebug< logger = opts.logger, }) { const planId = fetchAPI.crypto.randomUUID(); - const delegationPlanStartLogger = logger.child('delegation-plan-start'); + const planLogger = logger.child({ planId, typeName }); + const delegationPlanStartLogger = planLogger.child('delegation-plan-start'); delegationPlanStartLogger.debug(() => { - const logObj: Record = { - planId, - subgraph, - typeName, - }; + const logObj: Record = {}; if (variables && Object.keys(variables).length) { logObj['variables'] = variables; } @@ -51,21 +47,16 @@ export function useDelegationPlanDebug< } return logObj; }); - const start = performance.now(); return ({ delegationPlan }) => { const delegationPlanDoneLogger = logger.child('delegation-plan-done'); - delegationPlanDoneLogger.debug(() => ({ - planId, - plan: delegationPlan.map((plan) => { - const planObj: Record = {}; - for (const [subschema, selectionSet] of plan) { - if (subschema.name) { - planObj[subschema.name] = print(selectionSet); - } + delegationPlanDoneLogger.debug(() => delegationPlan.map((plan) => { + const planObj: Record = {}; + for (const [subschema, selectionSet] of plan) { + if (subschema.name) { + planObj[subschema.name] = print(selectionSet); } - return planObj; - }), - duration: performance.now() - start, + } + return planObj; })); }; }, @@ -79,16 +70,12 @@ export function useDelegationPlanDebug< typeName, logger = opts.logger, }) { - let stageId: string; let contextLog = stageExecuteLogById.get(context); if (!contextLog) { contextLog = new Set(); stageExecuteLogById.set(context, contextLog); } - const delegationStageLogger = logger.child('delegation-stage-execute'); const log = { - subgraph, - typeName, key: JSON.stringify(key), object: JSON.stringify(object), selectionSet: print(selectionSet), @@ -98,24 +85,23 @@ export function useDelegationPlanDebug< return; } contextLog.add(logStr); - stageId = fetchAPI.crypto.randomUUID(); - delegationStageLogger.debug('start', () => { + const logMeta: Record = { + stageId: fetchAPI.crypto.randomUUID(), + subgraph, + typeName, + }; + const delegationStageLogger = logger.child(logMeta); + delegationStageLogger.debug('delegation-plan-start', () => { return { - stageId, ...log, path: pathToArray(info.path).join(' | '), }; }); - const start = performance.now(); return ({ result }) => { const delegationStageExecuteDoneLogger = logger.child( 'delegation-stage-execute-done', ); - delegationStageExecuteDoneLogger.debug(() => ({ - stageId, - result: JSON.stringify(result, null), - duration: performance.now() - start, - })); + delegationStageExecuteDoneLogger.debug(() => result); }; }, }; diff --git a/packages/runtime/src/plugins/useSubgraphExecuteDebug.ts b/packages/runtime/src/plugins/useSubgraphExecuteDebug.ts index 85be7fc1ad..3a04f8724b 100644 --- a/packages/runtime/src/plugins/useSubgraphExecuteDebug.ts +++ b/packages/runtime/src/plugins/useSubgraphExecuteDebug.ts @@ -11,29 +11,29 @@ export function useSubgraphExecuteDebug< onYogaInit({ yoga }) { fetchAPI = yoga.fetchAPI; }, - onSubgraphExecute({ executionRequest, logger = opts.logger }) { - const subgraphExecuteId = fetchAPI.crypto.randomUUID(); + onSubgraphExecute({ + executionRequest, + logger = opts.logger, + }) { const subgraphExecuteHookLogger = logger.child({ - subgraphExecuteId, + subgraphExecuteId: fetchAPI.crypto.randomUUID(), + }); + const subgraphExecuteStartLogger = subgraphExecuteHookLogger.child( + 'subgraph-execute-start', + ); + subgraphExecuteStartLogger.debug(() => { + const logData: Record = {}; + if (executionRequest.document) { + logData['query'] = defaultPrintFn(executionRequest.document); + } + if ( + executionRequest.variables && + Object.keys(executionRequest.variables).length + ) { + logData['variables'] = executionRequest.variables; + } + return logData; }); - if (executionRequest) { - const subgraphExecuteStartLogger = subgraphExecuteHookLogger.child( - 'subgraph-execute-start', - ); - subgraphExecuteStartLogger.debug(() => { - const logData: Record = {}; - if (executionRequest.document) { - logData['query'] = defaultPrintFn(executionRequest.document); - } - if ( - executionRequest.variables && - Object.keys(executionRequest.variables).length - ) { - logData['variables'] = executionRequest.variables; - } - return logData; - }); - } const start = performance.now(); return function onSubgraphExecuteDone({ result }) { const subgraphExecuteEndLogger = subgraphExecuteHookLogger.child( @@ -54,10 +54,7 @@ export function useSubgraphExecuteDebug< }, }; } - subgraphExecuteEndLogger.debug(() => ({ - result, - duration: performance.now() - start, - })); + subgraphExecuteEndLogger.debug(result); return void 0; }; },