Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
97769d1
feat(opentelemetry): add support for b3 + jaeger + custom propagators…
EmrysMyrddin Apr 18, 2025
c5a5ac5
feat(opentelemetry): add support for b3 + jaeger + custom propagators…
EmrysMyrddin Apr 18, 2025
c07fa7b
feat(opentelemetry): add support for b3 + jaeger + custom propagators…
EmrysMyrddin Apr 18, 2025
018f511
feat(opentelemetry): add support for b3 + jaeger + custom propagators…
EmrysMyrddin Apr 18, 2025
e6d749d
starter pack
enisdenjo Mar 27, 2025
a50fe26
more begin
enisdenjo Mar 27, 2025
2c0a8f8
move around
enisdenjo Mar 27, 2025
371285b
basic tests
enisdenjo Mar 27, 2025
74c42c8
todo
enisdenjo Mar 27, 2025
350a4ff
test no attrs
enisdenjo Mar 27, 2025
5a83f4d
logger options
enisdenjo Mar 27, 2025
5277e42
symbol things
enisdenjo Mar 27, 2025
d1856e2
allow any object as context
enisdenjo Mar 27, 2025
5e2e487
more methods
enisdenjo Mar 27, 2025
d832e7d
todo
enisdenjo Mar 27, 2025
fc21686
some todos and attrval
enisdenjo Mar 27, 2025
bfd683e
docs
enisdenjo Mar 27, 2025
8754b12
parent attrs
enisdenjo Apr 2, 2025
9d8d0c8
remove context
enisdenjo Apr 2, 2025
fd8eb84
child
enisdenjo Apr 2, 2025
694d399
todo
enisdenjo Apr 2, 2025
23bdfaa
loglgevel prefix
enisdenjo Apr 3, 2025
23cd514
test level
enisdenjo Apr 3, 2025
4e7994f
test child
enisdenjo Apr 3, 2025
4fc9a4a
refactor
enisdenjo Apr 3, 2025
8567986
unwrap lazy attrs
enisdenjo Apr 3, 2025
2142191
no unwrap if no log
enisdenjo Apr 3, 2025
d78d7b6
todos
enisdenjo Apr 3, 2025
f62a23c
refactor logger
enisdenjo Apr 3, 2025
da9bf49
log and prepare
enisdenjo Apr 3, 2025
b2579b5
safe stringify
enisdenjo Apr 3, 2025
09f59ea
legacy logger
enisdenjo Apr 7, 2025
2f4654a
refactor some
enisdenjo Apr 8, 2025
8c8c6cc
any attr value
enisdenjo Apr 8, 2025
3a42983
fetch with new log
enisdenjo Apr 8, 2025
333389e
logger attrs parser and stuff
enisdenjo Apr 8, 2025
89880ab
inherit child and some fixes
enisdenjo Apr 8, 2025
3883b07
refactor
enisdenjo Apr 9, 2025
3b98c54
refactor more
enisdenjo Apr 8, 2025
a065c06
remove logger from cache hooks
enisdenjo Apr 9, 2025
4d7e8c8
legacylogger for hive console plugin
enisdenjo Apr 9, 2025
e36eadf
retry logger
enisdenjo Apr 9, 2025
96cc3aa
pass in logger to usewebhooks
enisdenjo Apr 9, 2025
fda7316
use hmac
enisdenjo Apr 9, 2025
50bf5f3
some todos
enisdenjo Apr 9, 2025
1cd36b9
drop for now
enisdenjo Apr 9, 2025
ef1002c
no color if no process
enisdenjo Apr 9, 2025
b445750
logger -> log
enisdenjo Apr 9, 2025
bfc2917
nest logger writer
enisdenjo Apr 9, 2025
a743dd0
fix unit tests
enisdenjo Apr 9, 2025
72660e9
config syntax
enisdenjo Apr 9, 2025
477a860
format
enisdenjo Apr 9, 2025
ae4c7dd
chore(dependencies): updated changesets for modified dependencies
github-actions[bot] Apr 9, 2025
dd0735b
logger 0.0.0
enisdenjo Apr 9, 2025
a07b335
logger level can be changed
enisdenjo Apr 10, 2025
90b75c3
some cleanup
enisdenjo Apr 10, 2025
1117ded
legacylogger tests and fixes
enisdenjo Apr 10, 2025
4ab616e
request logger
enisdenjo Apr 10, 2025
35d1d8c
move over wrapfetchwith hooks
enisdenjo Apr 10, 2025
06e8fae
todo
enisdenjo Apr 10, 2025
66747a4
chore(dependencies): updated changesets for modified dependencies
github-actions[bot] Apr 10, 2025
a8dd58e
fix wrap fetch
enisdenjo Apr 11, 2025
ed29fbd
fix types and provide legacy logger under "logger" for some components
enisdenjo Apr 16, 2025
6dc0011
make sure meshlogger fits types of legacylogger
enisdenjo Apr 16, 2025
ee40f49
retryonschemareload might not have a request (websockets)
enisdenjo Apr 16, 2025
c530e0a
request is not there for websokets
enisdenjo Apr 16, 2025
fedfa50
skip error serial on bun
enisdenjo Apr 16, 2025
df4b1d4
transform class private methods for jest
enisdenjo Apr 16, 2025
b90c893
correct snap for bun
enisdenjo Apr 17, 2025
02e2f8e
skip instead of todo for leaktests
enisdenjo Apr 17, 2025
6c38081
jwt use log and enable aws
enisdenjo Apr 17, 2025
ed802f8
logger for request in hmac
enisdenjo Apr 17, 2025
5c34afe
changeset for logger
enisdenjo Apr 17, 2025
d0eab94
hmac needs logger for services
enisdenjo Apr 17, 2025
f78c5c7
disallow deep function unwraps only
enisdenjo Apr 17, 2025
df9d06d
test edgecase
enisdenjo Apr 17, 2025
a45e678
shallow merge attrs
enisdenjo Apr 18, 2025
51ae744
no unwrap of attr values
enisdenjo Apr 18, 2025
ea64b75
no logging of lazy attributes returning nothing
enisdenjo Apr 18, 2025
bf18bb0
delegation plan is under delegation plan
enisdenjo Apr 18, 2025
d8a4e84
use fastsafestringify for formatting
enisdenjo Apr 18, 2025
c961348
explain deps
enisdenjo Apr 18, 2025
1ae6d9f
no scoped
enisdenjo Apr 18, 2025
1b97a48
fix lockfile
enisdenjo Apr 18, 2025
2f72463
docs(examples): converted from e2es
theguild-bot Apr 18, 2025
8c0823a
flush test and no flush in writers
enisdenjo Apr 18, 2025
07e4e90
async dispose
enisdenjo Apr 18, 2025
8226590
logger doesnt need to implement logwriter
enisdenjo Apr 18, 2025
94c54e7
better plain object detector and use toJSON
enisdenjo Apr 18, 2025
f886b0f
improve objectify and serialise and tests
enisdenjo Apr 18, 2025
9f5cde4
handle circular
enisdenjo Apr 18, 2025
9caea49
test aggregate errors
enisdenjo Apr 18, 2025
3b81bae
stable errors for testing
enisdenjo Apr 18, 2025
5779e7f
fix types for memorylogwriter
enisdenjo Apr 18, 2025
b584e63
pretty attrs stringify
enisdenjo Apr 18, 2025
e9ca3a6
nofroget
enisdenjo Apr 18, 2025
4dc404c
color
enisdenjo Apr 20, 2025
fb0a4a0
test console writer
enisdenjo Apr 20, 2025
85adf51
no flush
enisdenjo Apr 20, 2025
7416692
json log on log json
enisdenjo Apr 20, 2025
e54aad9
begin readme
enisdenjo Apr 20, 2025
e4c6df6
more
enisdenjo Apr 20, 2025
b97c6f1
writers
enisdenjo Apr 20, 2025
7e1009f
aggregate writes
enisdenjo Apr 20, 2025
ac93cd9
message formatting
enisdenjo Apr 20, 2025
9dd5b34
child loggers
enisdenjo Apr 20, 2025
585bfa2
default and stuff
enisdenjo Apr 20, 2025
74894a4
logger for request
enisdenjo Apr 20, 2025
784cbdd
color brackets
enisdenjo Apr 20, 2025
3f4f92a
dynamic level
enisdenjo Apr 21, 2025
1d55efa
exprsmng
enisdenjo Apr 21, 2025
34afde5
otel log
enisdenjo Apr 21, 2025
50d3693
disable logging example
enisdenjo Apr 21, 2025
e018254
arrayfrom
enisdenjo Apr 21, 2025
07dc9da
h++
enisdenjo Apr 21, 2025
4e0f594
logging methods and args
enisdenjo Apr 21, 2025
9a07fcc
no test writers on bun
enisdenjo Apr 21, 2025
b352916
.js
enisdenjo Apr 21, 2025
4014e63
advanced serialisation
enisdenjo Apr 21, 2025
3add1d0
lazy args
enisdenjo Apr 21, 2025
6451a4c
rename move
enisdenjo Apr 21, 2025
a9b1c89
pino writer
enisdenjo Apr 21, 2025
f9e619d
winston logger
enisdenjo Apr 21, 2025
aef52a3
document other
enisdenjo Apr 21, 2025
8cec70e
winstons node js
enisdenjo Apr 21, 2025
834dff8
use baseloger pino
enisdenjo Apr 21, 2025
713779d
use pino writer
enisdenjo Apr 21, 2025
62755f1
remove legacy loggers
enisdenjo Apr 21, 2025
689f5d1
chore(dependencies): updated changesets for modified dependencies
github-actions[bot] Apr 21, 2025
3aa144d
change case
enisdenjo Apr 21, 2025
336b6e3
more log detauls and information
enisdenjo Apr 21, 2025
7ea0540
log errors and more things
enisdenjo Apr 21, 2025
954bdf2
legacylogger fot getincontext
enisdenjo Apr 21, 2025
080026c
this ok
enisdenjo Apr 21, 2025
f34267b
explain potential placholders
enisdenjo Apr 23, 2025
e972362
warn on failing async writes right away
enisdenjo Apr 23, 2025
b47b06d
create pendingwrites set only when necessary
enisdenjo Apr 23, 2025
7422683
hide console errorrs during async write test
enisdenjo Apr 23, 2025
da28e1b
dont overwrite log instances
enisdenjo Apr 23, 2025
57e5c8b
nodejs util inspect custom symol
enisdenjo Apr 24, 2025
a321bca
better child
enisdenjo May 20, 2025
acc2207
debug mode enabled
enisdenjo May 20, 2025
a7e5689
better child
enisdenjo May 20, 2025
118de56
ensure signal
enisdenjo May 20, 2025
4e0a76f
changesets
enisdenjo May 22, 2025
68c7863
rootvalue execution request
enisdenjo May 22, 2025
69ec041
use log instead of logger
enisdenjo May 22, 2025
4dd6a77
bench logger msg
enisdenjo May 22, 2025
4d99d76
test console writer in bun too
enisdenjo May 22, 2025
9faced0
transportcontext is not required
enisdenjo May 26, 2025
dd28f83
log mode and version
enisdenjo May 26, 2025
84a3ddc
only format if there are interpolation values
enisdenjo May 26, 2025
2d9ce0e
earlier version and mode log
enisdenjo May 26, 2025
7184bde
use template literals
enisdenjo May 26, 2025
6b7df87
docs(examples): converted from e2es
theguild-bot Jun 5, 2025
274edcc
update expected log for schema watcher
enisdenjo Jun 5, 2025
6513e64
docs(examples): converted from e2es
theguild-bot Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/@graphql-hive_gateway-1030-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-hive/gateway': patch
---

dependencies updates:

- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
9 changes: 9 additions & 0 deletions .changeset/@graphql-hive_gateway-runtime-1030-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@graphql-hive/gateway-runtime': patch
---

dependencies updates:

- Added dependency [`@envelop/instrumentation@^1.0.0` ↗︎](https://www.npmjs.com/package/@envelop/instrumentation/v/1.0.0) (to `dependencies`)
- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
- Removed dependency [`@graphql-hive/logger-json@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger-json/v/workspace:^) (from `dependencies`)
7 changes: 7 additions & 0 deletions .changeset/@graphql-mesh_fusion-runtime-1030-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/fusion-runtime': patch
---

dependencies updates:

- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/plugin-prometheus': patch
---

dependencies updates:

- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-mesh/transport-common': patch
---

dependencies updates:

- Added dependency [`@graphql-hive/logger@workspace:^` ↗︎](https://www.npmjs.com/package/@graphql-hive/logger/v/workspace:^) (to `dependencies`)
19 changes: 19 additions & 0 deletions .changeset/itchy-ways-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@graphql-mesh/hmac-upstream-signature': major
'@graphql-mesh/transport-http-callback': major
'@graphql-mesh/plugin-opentelemetry': major
'@graphql-mesh/plugin-prometheus': major
'@graphql-mesh/transport-common': major
'@graphql-mesh/plugin-jwt-auth': major
'@graphql-mesh/fusion-runtime': major
'@graphql-mesh/transport-ws': major
'@graphql-hive/gateway': major
'@graphql-hive/gateway-runtime': major
'@graphql-hive/nestjs': major
---

Introduce and use the new Hive Logger

- [Read more about it on the Hive Logger documentation here.](https://the-guild.dev/graphql/hive/docs/logger)

- If coming from Hive Gateway v1, [read the migration guide here.](https://the-guild.dev/graphql/hive/docs/migration-guides/gateway-v1-v2)
7 changes: 7 additions & 0 deletions .changeset/tough-elephants-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@graphql-hive/logger': major
---

Introducing Hive Logger

[Read more about it on the Hive Logger documentation website.](https://the-guild.dev/graphql/hive/docs/logger)
1 change: 1 addition & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = {
['@babel/plugin-proposal-decorators', { version: '2023-11' }],
'@babel/plugin-transform-class-properties',
'@babel/plugin-proposal-explicit-resource-management',
'@babel/plugin-transform-private-methods',
],
};
4 changes: 2 additions & 2 deletions e2e/config-syntax-error/config-syntax-error.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ it.skipIf(
}),
).rejects.toThrowError(
gatewayRunner === 'bun' || gatewayRunner === 'bun-docker'
? /error: Expected "{" but found "hello"(.|\n)*\/custom-resolvers.ts:8:11/
: /SyntaxError \[Error\]: Error transforming .*(\/|\\)custom-resolvers.ts: Unexpected token, expected "{" \(8:11\)/,
? /Expected \\"{\\" but found \\"hello\\"(.|\n)*\/custom-resolvers.ts/
: /Error transforming .*(\/|\\)custom-resolvers.ts: Unexpected token, expected \\"{\\" \(8:11\)/,
);
},
);
7 changes: 3 additions & 4 deletions e2e/graphos-polling/services/gateway-fastify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createGatewayRuntime } from '@graphql-hive/gateway-runtime';
import { createLoggerFromPino } from '@graphql-hive/logger-pino';
import { createGatewayRuntime, Logger } from '@graphql-hive/gateway-runtime';
import { PinoLogWriter } from '@graphql-hive/logger/writers/pino';
import {
createOtlpHttpExporter,
useOpenTelemetry,
Expand Down Expand Up @@ -43,8 +43,7 @@ export interface FastifyContext {
}

const gw = createGatewayRuntime<FastifyContext>({
// Integrate Fastify's logger / Pino with the gateway logger
logging: createLoggerFromPino(app.log),
logging: new Logger({ writers: [new PinoLogWriter(app.log)] }),
// Align with Fastify
requestId: {
// Use the same header name as Fastify
Expand Down
1 change: 1 addition & 0 deletions e2e/hmac-auth-https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@apollo/server": "^4.12.2",
"@apollo/subgraph": "^2.11.0",
"@graphql-hive/gateway": "workspace:^",
"@graphql-hive/logger": "workspace:^",
"@graphql-mesh/compose-cli": "^1.4.1",
"@graphql-mesh/hmac-upstream-signature": "workspace:^",
"@graphql-mesh/plugin-jwt-auth": "workspace:^",
Expand Down
2 changes: 2 additions & 0 deletions e2e/hmac-auth-https/services/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { readFileSync } from 'fs';
import { createServer } from 'https';
import { join } from 'path';
import { buildSubgraphSchema } from '@apollo/subgraph';
import { Logger } from '@graphql-hive/logger';
import { useHmacSignatureValidation } from '@graphql-mesh/hmac-upstream-signature';
import {
JWTExtendContextFields,
Expand All @@ -20,6 +21,7 @@ const yoga = createYoga({
logging: true,
plugins: [
useHmacSignatureValidation({
log: new Logger({ level: 'debug' }),
secret: 'HMAC_SIGNING_SECRET',
}),
useForwardedJWT({}),
Expand Down
6 changes: 3 additions & 3 deletions e2e/retry-timeout/gateway.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export const gatewayConfig = defineConfig({
maxRetries: 4,
},
upstreamTimeout: 300,
plugins(ctx) {
plugins() {
return [
...(process.env['DEDUPLICATE_REQUEST'] ? [useDeduplicateRequest()] : []),
{
onFetch() {
onFetch({ context }) {
i++;
ctx.logger.info(`[FETCHING] #${i}`);
context.log.info(`[FETCHING] #${i}`);
},
},
];
Expand Down
2 changes: 1 addition & 1 deletion e2e/supergraph-file-watcher/supergraph-file-watcher.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ it('should detect supergraph file change and reload schema', async () => {
for (;;) {
timeout.throwIfAborted();
await setTimeout(100);
if (gw.getStd('both').match(/invalidating supergraph/i)) {
if (gw.getStd('both').match(/supergraph changed/i)) {
break;
}
}
Expand Down
Binary file modified examples/hmac-auth-https/example.tar.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions examples/hmac-auth-https/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/hmac-auth-https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@apollo/server": "^4.12.2",
"@apollo/subgraph": "^2.11.0",
"@graphql-hive/gateway": "^1.15.0",
"@graphql-hive/logger": "^0.0.0",
"@graphql-mesh/compose-cli": "^1.4.1",
"@graphql-mesh/hmac-upstream-signature": "^1.2.27",
"@graphql-mesh/plugin-jwt-auth": "^1.5.5",
Expand Down
2 changes: 2 additions & 0 deletions examples/hmac-auth-https/services/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { readFileSync } from 'fs';
import { createServer } from 'https';
import { join } from 'path';
import { buildSubgraphSchema } from '@apollo/subgraph';
import { Logger } from '@graphql-hive/logger';
import { useHmacSignatureValidation } from '@graphql-mesh/hmac-upstream-signature';
import {
JWTExtendContextFields,
Expand All @@ -19,6 +20,7 @@ const yoga = createYoga({
logging: true,
plugins: [
useHmacSignatureValidation({
log: new Logger({ level: 'debug' }),
secret: 'HMAC_SIGNING_SECRET',
}),
useForwardedJWT({}),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@babel/plugin-proposal-explicit-resource-management": "7.27.4",
"@babel/plugin-transform-class-properties": "7.27.1",
"@babel/plugin-transform-class-static-block": "7.27.1",
"@babel/plugin-transform-private-methods": "^7.27.1",
"@babel/preset-env": "7.27.2",
"@babel/preset-typescript": "7.27.1",
"@changesets/changelog-github": "^0.5.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/delegate/src/finalizeGatewayRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,6 @@ function finalizeSelectionSet(
leave: (node) => {
const type = typeInfo.getType();
if (type == null) {
// console.warn(
// `Invalid type for node: ${typeInfo.getParentType()?.name}.${node.name.value}`,
// );
return null;
}
const namedType = getNamedType(type);
Expand Down
1 change: 1 addition & 0 deletions packages/fusion-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"dependencies": {
"@envelop/core": "^5.2.3",
"@envelop/instrumentation": "^1.0.0",
"@graphql-hive/logger": "workspace:^",
"@graphql-mesh/cross-helpers": "^0.4.10",
"@graphql-mesh/transport-common": "workspace:^",
"@graphql-mesh/types": "^0.104.0",
Expand Down
8 changes: 3 additions & 5 deletions packages/fusion-runtime/src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function getExecutorForUnifiedGraph<TContext>(
() => unifiedGraphManager.getContext(execReq.context),
(context) => {
function handleExecutor(executor: Executor) {
opts?.transportContext?.logger?.debug(
opts?.transportContext?.log.debug(
'Executing request on unified graph',
() => print(execReq.document),
);
Expand All @@ -50,7 +50,7 @@ export function getExecutorForUnifiedGraph<TContext>(
return handleMaybePromise(
() => unifiedGraphManager.getUnifiedGraph(),
(unifiedGraph) => {
opts?.transportContext?.logger?.debug(
opts?.transportContext?.log.debug(
'Executing request on unified graph',
() => print(execReq.document),
);
Expand All @@ -70,9 +70,7 @@ export function getExecutorForUnifiedGraph<TContext>(
enumerable: true,
get() {
return function unifiedGraphExecutorDispose() {
opts?.transportContext?.logger?.debug(
'Disposing unified graph executor',
);
opts?.transportContext?.log.debug('Disposing unified graph executor');
return unifiedGraphManager[DisposableSymbols.asyncDispose]();
};
},
Expand Down
22 changes: 8 additions & 14 deletions packages/fusion-runtime/src/federation/supergraph.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LegacyLogger, Logger } from '@graphql-hive/logger';
import type { YamlConfig } from '@graphql-mesh/types';
import {
getInContextSDK,
requestIdByRequest,
resolveAdditionalResolversWithoutImport,
} from '@graphql-mesh/utils';
import type {
Expand Down Expand Up @@ -158,7 +158,8 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
onDelegateHooks,
additionalTypeDefs: additionalTypeDefsFromConfig = [],
additionalResolvers: additionalResolversFromConfig = [],
logger,
// no logger was provided, use a muted logger for consistency across plugin hooks
log: rootLog = new Logger({ level: false }),
}: UnifiedGraphHandlerOpts): UnifiedGraphHandlerResult {
const additionalTypeDefs = [...asArray(additionalTypeDefsFromConfig)];
const additionalResolvers = [...asArray(additionalResolversFromConfig)];
Expand Down Expand Up @@ -230,7 +231,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
originalResolver,
typeName,
onDelegationStageExecuteHooks,
logger,
rootLog,
);
}
}
Expand Down Expand Up @@ -278,7 +279,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
executableUnifiedGraph,
// @ts-expect-error Legacy Mesh RawSource is not compatible with new Mesh
subschemas,
logger,
LegacyLogger.from(rootLog),
onDelegateHooks || [],
);
const stitchingInfo = executableUnifiedGraph.extensions?.[
Expand Down Expand Up @@ -306,16 +307,9 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
delegationPlanBuilder = newDelegationPlanBuilder;
}
const onDelegationPlanDoneHooks: OnDelegationPlanDoneHook[] = [];
let currentLogger = logger;
let requestId: string | undefined;
if (context?.request) {
requestId = requestIdByRequest.get(context.request);
if (requestId) {
currentLogger = currentLogger?.child({ requestId });
}
}
let log = context.log as Logger;
if (sourceSubschema.name) {
currentLogger = currentLogger?.child({
log = log.child({
subgraph: sourceSubschema.name,
});
}
Expand All @@ -328,7 +322,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
variables,
fragments,
fieldNodes,
logger: currentLogger,
log,
context,
info,
delegationPlanBuilder,
Expand Down
Loading
Loading