Skip to content

Commit 9f2c194

Browse files
Upcoming Release Changes (#668)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 52df7fa commit 9f2c194

File tree

6 files changed

+50
-66
lines changed

6 files changed

+50
-66
lines changed

.changeset/@graphql-hive_gateway-664-dependencies.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/gateway/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @graphql-hive/gateway
22

3+
## 1.10.3
4+
5+
### Patch Changes
6+
7+
- [#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:
8+
9+
- 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`)
10+
311
## 1.10.2
412

513
### Patch Changes

packages/gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-hive/gateway",
3-
"version": "1.10.2",
3+
"version": "1.10.3",
44
"type": "module",
55
"repository": {
66
"type": "git",

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-hive/gateway-runtime",
3-
"version": "1.4.15",
3+
"version": "1.4.16",
44
"type": "module",
55
"repository": {
66
"type": "git",

packages/runtime/src/plugins/useDelegationPlanDebug.ts

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export function useDelegationPlanDebug<
1414
fetchAPI = yoga.fetchAPI;
1515
},
1616
onDelegationPlan({
17-
subgraph,
1817
typeName,
1918
variables,
2019
fragments,
@@ -23,13 +22,10 @@ export function useDelegationPlanDebug<
2322
logger = opts.logger,
2423
}) {
2524
const planId = fetchAPI.crypto.randomUUID();
26-
const delegationPlanStartLogger = logger.child('delegation-plan-start');
25+
const planLogger = logger.child({ planId, typeName });
26+
const delegationPlanStartLogger = planLogger.child('delegation-plan-start');
2727
delegationPlanStartLogger.debug(() => {
28-
const logObj: Record<string, any> = {
29-
planId,
30-
subgraph,
31-
typeName,
32-
};
28+
const logObj: Record<string, any> = {};
3329
if (variables && Object.keys(variables).length) {
3430
logObj['variables'] = variables;
3531
}
@@ -51,21 +47,16 @@ export function useDelegationPlanDebug<
5147
}
5248
return logObj;
5349
});
54-
const start = performance.now();
5550
return ({ delegationPlan }) => {
5651
const delegationPlanDoneLogger = logger.child('delegation-plan-done');
57-
delegationPlanDoneLogger.debug(() => ({
58-
planId,
59-
plan: delegationPlan.map((plan) => {
60-
const planObj: Record<string, string> = {};
61-
for (const [subschema, selectionSet] of plan) {
62-
if (subschema.name) {
63-
planObj[subschema.name] = print(selectionSet);
64-
}
52+
delegationPlanDoneLogger.debug(() => delegationPlan.map((plan) => {
53+
const planObj: Record<string, string> = {};
54+
for (const [subschema, selectionSet] of plan) {
55+
if (subschema.name) {
56+
planObj[subschema.name] = print(selectionSet);
6557
}
66-
return planObj;
67-
}),
68-
duration: performance.now() - start,
58+
}
59+
return planObj;
6960
}));
7061
};
7162
},
@@ -79,16 +70,12 @@ export function useDelegationPlanDebug<
7970
typeName,
8071
logger = opts.logger,
8172
}) {
82-
let stageId: string;
8373
let contextLog = stageExecuteLogById.get(context);
8474
if (!contextLog) {
8575
contextLog = new Set();
8676
stageExecuteLogById.set(context, contextLog);
8777
}
88-
const delegationStageLogger = logger.child('delegation-stage-execute');
8978
const log = {
90-
subgraph,
91-
typeName,
9279
key: JSON.stringify(key),
9380
object: JSON.stringify(object),
9481
selectionSet: print(selectionSet),
@@ -98,24 +85,23 @@ export function useDelegationPlanDebug<
9885
return;
9986
}
10087
contextLog.add(logStr);
101-
stageId = fetchAPI.crypto.randomUUID();
102-
delegationStageLogger.debug('start', () => {
88+
const logMeta: Record<string, string> = {
89+
stageId: fetchAPI.crypto.randomUUID(),
90+
subgraph,
91+
typeName,
92+
};
93+
const delegationStageLogger = logger.child(logMeta);
94+
delegationStageLogger.debug('delegation-plan-start', () => {
10395
return {
104-
stageId,
10596
...log,
10697
path: pathToArray(info.path).join(' | '),
10798
};
10899
});
109-
const start = performance.now();
110100
return ({ result }) => {
111101
const delegationStageExecuteDoneLogger = logger.child(
112102
'delegation-stage-execute-done',
113103
);
114-
delegationStageExecuteDoneLogger.debug(() => ({
115-
stageId,
116-
result: JSON.stringify(result, null),
117-
duration: performance.now() - start,
118-
}));
104+
delegationStageExecuteDoneLogger.debug(() => result);
119105
};
120106
},
121107
};

packages/runtime/src/plugins/useSubgraphExecuteDebug.ts

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ export function useSubgraphExecuteDebug<
1111
onYogaInit({ yoga }) {
1212
fetchAPI = yoga.fetchAPI;
1313
},
14-
onSubgraphExecute({ executionRequest, logger = opts.logger }) {
15-
const subgraphExecuteId = fetchAPI.crypto.randomUUID();
14+
onSubgraphExecute({
15+
executionRequest,
16+
logger = opts.logger,
17+
}) {
1618
const subgraphExecuteHookLogger = logger.child({
17-
subgraphExecuteId,
19+
subgraphExecuteId: fetchAPI.crypto.randomUUID(),
20+
});
21+
const subgraphExecuteStartLogger = subgraphExecuteHookLogger.child(
22+
'subgraph-execute-start',
23+
);
24+
subgraphExecuteStartLogger.debug(() => {
25+
const logData: Record<string, any> = {};
26+
if (executionRequest.document) {
27+
logData['query'] = defaultPrintFn(executionRequest.document);
28+
}
29+
if (
30+
executionRequest.variables &&
31+
Object.keys(executionRequest.variables).length
32+
) {
33+
logData['variables'] = executionRequest.variables;
34+
}
35+
return logData;
1836
});
19-
if (executionRequest) {
20-
const subgraphExecuteStartLogger = subgraphExecuteHookLogger.child(
21-
'subgraph-execute-start',
22-
);
23-
subgraphExecuteStartLogger.debug(() => {
24-
const logData: Record<string, any> = {};
25-
if (executionRequest.document) {
26-
logData['query'] = defaultPrintFn(executionRequest.document);
27-
}
28-
if (
29-
executionRequest.variables &&
30-
Object.keys(executionRequest.variables).length
31-
) {
32-
logData['variables'] = executionRequest.variables;
33-
}
34-
return logData;
35-
});
36-
}
3737
const start = performance.now();
3838
return function onSubgraphExecuteDone({ result }) {
3939
const subgraphExecuteEndLogger = subgraphExecuteHookLogger.child(
@@ -54,10 +54,7 @@ export function useSubgraphExecuteDebug<
5454
},
5555
};
5656
}
57-
subgraphExecuteEndLogger.debug(() => ({
58-
result,
59-
duration: performance.now() - start,
60-
}));
57+
subgraphExecuteEndLogger.debug(result);
6158
return void 0;
6259
};
6360
},

0 commit comments

Comments
 (0)