Skip to content

Commit

Permalink
enhance: better debug messages for readiness check endpoint (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan authored Dec 19, 2024
1 parent dd7e2ad commit 122c013
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .changeset/gorgeous-bananas-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
'@graphql-hive/gateway-runtime': patch
---

Better messages on debug logs of readiness check endpoint;

Before;
On successful readiness check, the gateway was logging the following message:
```
Readiness check passed: Supergraph loaded
```
Because this makes the users think it was just loaded.
After;
On successful readiness check, the gateway will log the following message:
```
Readiness check passed because supergraph has been loaded already
```

On failed readiness check, the gateway was logging the following message:
Before;
```
Readiness check failed: Supergraph not loaded
```
It should make the users think it was not loaded or there is an issue with the supergraph.

After;
```
Readiness check failed because supergraph has not been loaded yet or failed to load
```
8 changes: 6 additions & 2 deletions packages/runtime/src/createGatewayRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,14 @@ export function createGatewayRuntime<
unifiedGraphManager.getUnifiedGraph(),
(schema) => {
if (!schema) {
logger.debug(`Readiness check failed: Supergraph cannot be loaded`);
logger.debug(
`Readiness check failed because supergraph has not been loaded yet or failed to load`,
);
return false;
}
logger.debug(`Readiness check passed: Supergraph loaded`);
logger.debug(
`Readiness check passed because supergraph has been loaded already`,
);
return true;
},
(err) => {
Expand Down

0 comments on commit 122c013

Please sign in to comment.