-
Notifications
You must be signed in to change notification settings - Fork 352
enhance(logging): more clear key-value pairs #8375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis pull request introduces patches across multiple GraphQL Mesh and OmniGraph packages. The updates primarily focus on refining logging practices by switching from string-based to object-based logger contexts, adjusting logger prefixes, and improving log formatting. In addition, the pull request renames specific GraphQL query and subscription identifiers to enhance clarity. Several configuration functions are also updated to accept a logger instance, ensuring a more consistent logging experience across the codebase. Changes
Possibly related PRs
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
packages/legacy/cli/src/commands/serve/serve.tsOops! Something went wrong! :( ESLint: 9.20.1 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by packages/legacy/utils/src/logger.tsOops! Something went wrong! :( ESLint: 9.20.1 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by packages/legacy/types/src/index.tsOops! Something went wrong! :( ESLint: 9.20.1 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by ✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Apollo Federation Subgraph Compatibility Results
Learn more: |
💻 Website PreviewThe latest changes are available as preview in: https://5d6452c6.graphql-mesh.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/legacy/mergers/bare/src/index.ts (1)
25-25
: Consider adding merger type to debug message.While the change to object-based logging is good, consider enhancing the debug message on line 23 to include the merger type transition in a structured format.
- this.options.logger.debug( - `Switching to Stitching merger due to the transforms and additional resolvers`, - ); + this.options.logger.debug('Switching merger type', { + from: this.name, + to: 'stitching', + reason: 'transforms and additional resolvers' + });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (22)
.changeset/heavy-swans-act.md
(1 hunks)examples/grpc-example/example-queries/MoviesByCast.stream.graphql
(1 hunks)examples/grpc-example/example-queries/MoviesByCast.subscription.graphql
(1 hunks)packages/compose-cli/src/getComposedSchemaFromConfig.ts
(1 hunks)packages/compose-cli/src/run.ts
(1 hunks)packages/legacy/cli/src/commands/serve/serve.ts
(3 hunks)packages/legacy/cli/src/config.ts
(5 hunks)packages/legacy/cli/src/index.ts
(4 hunks)packages/legacy/config/src/process.ts
(8 hunks)packages/legacy/config/src/utils.ts
(1 hunks)packages/legacy/mergers/bare/src/index.ts
(1 hunks)packages/legacy/runtime/src/get-mesh.ts
(2 hunks)packages/legacy/types/src/index.ts
(1 hunks)packages/legacy/utils/src/in-context-sdk.ts
(2 hunks)packages/legacy/utils/src/logger.ts
(6 hunks)packages/legacy/utils/src/wrapFetchWithHooks.ts
(1 hunks)packages/loaders/grpc/src/grpcLoaderHelper.ts
(2 hunks)packages/loaders/json-schema/src/getDereferencedJSONSchemaFromOperations.ts
(1 hunks)packages/plugins/http-cache/src/index.ts
(1 hunks)packages/transports/grpc/src/index.ts
(1 hunks)packages/transports/rest/src/directives/httpOperation.ts
(1 hunks)packages/transports/rest/src/directives/pubsubOperation.ts
(2 hunks)
✅ Files skipped from review due to trivial changes (7)
- examples/grpc-example/example-queries/MoviesByCast.stream.graphql
- examples/grpc-example/example-queries/MoviesByCast.subscription.graphql
- packages/transports/grpc/src/index.ts
- packages/compose-cli/src/run.ts
- packages/plugins/http-cache/src/index.ts
- .changeset/heavy-swans-act.md
- packages/loaders/grpc/src/grpcLoaderHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms (12)
- GitHub Check: unit / node 22
- GitHub Check: integration / node 22
- GitHub Check: unit / node 20
- GitHub Check: integration / node 20
- GitHub Check: unit / node 18
- GitHub Check: integration / node 18
- GitHub Check: release / snapshot
- GitHub Check: e2e / node v22
- GitHub Check: e2e / node v20
- GitHub Check: e2e / node v18
- GitHub Check: deployment
- GitHub Check: check
🔇 Additional comments (26)
packages/transports/rest/src/directives/pubsubOperation.ts (2)
21-21
: LGTM! Improved logger context structure.The change from string-based to object-based logger context enhances log clarity and searchability.
Also applies to: 40-40
41-41
: LGTM! Enhanced debug message structure.The debug message now uses a more structured format with object parameters, improving log parsing and readability.
packages/loaders/json-schema/src/getDereferencedJSONSchemaFromOperations.ts (1)
34-34
: LGTM! Proper logger propagation.Adding the logger parameter ensures consistent logging context throughout the JSON schema dereferencing process.
packages/legacy/utils/src/wrapFetchWithHooks.ts (1)
52-52
: LGTM! Enhanced request tracing.Converting requestId to an object parameter improves request tracing and log filtering capabilities.
packages/legacy/utils/src/logger.ts (4)
78-78
: LGTM! Improved log message structure.The log message format has been enhanced to use consistent key-value pairs for timestamp and log level, making logs more structured and easier to parse.
Also applies to: 88-88, 99-99, 110-110, 122-122
128-139
: LGTM! Enhanced child logger flexibility.The
child
method now accepts both string and object inputs, providing more flexibility in log context creation while maintaining backward compatibility.
141-147
: LGTM! Enhanced prefix flexibility.The
addPrefix
method now accepts both string and object inputs, consistent with thechild
method changes.
154-163
: LGTM! Well-implemented name formatting.The
stringifyName
function effectively handles both string and object inputs, producing consistent key-value pair output.packages/legacy/cli/src/commands/serve/serve.ts (2)
107-107
: LGTM! Enhanced worker logging.Worker ID is now logged using a structured object format, improving log clarity and consistency.
128-129
: LGTM! Improved termination event logging.Termination events are now logged using a structured object format, enhancing log readability and consistency.
Also applies to: 152-156
packages/legacy/cli/src/config.ts (3)
16-16
: LGTM! Improved logger flexibility in config validation.The
validateConfig
function now accepts an optional logger parameter, allowing for consistent logger usage across the application.Also applies to: 36-36
63-63
: LGTM! Enhanced logger initialization.Default logger initialization has been simplified by removing the emoji prefix, and the logger parameter is now properly passed through the configuration chain.
Also applies to: 102-104
147-147
: LGTM! Consistent logger initialization in custom loader.The custom loader's logger initialization aligns with the new default empty prefix pattern.
packages/compose-cli/src/getComposedSchemaFromConfig.ts (1)
42-42
: LGTM! Enhanced subgraph logging.Subgraph logging now uses a structured object format, improving log clarity and consistency with the new logging patterns.
packages/legacy/config/src/utils.ts (1)
261-261
: LGTM! Improved logger prefix configuration.Removing the default emoji prefix in favor of an empty string enhances logging clarity and provides more flexibility in prefix configuration.
packages/legacy/types/src/index.ts (1)
225-225
: LGTM! Enhanced logger child method signature.The updated signature allows for structured key-value pair logging while maintaining backward compatibility with string inputs. This change improves log clarity and aligns with modern logging practices.
packages/legacy/runtime/src/get-mesh.ts (2)
106-106
: LGTM! Consistent logger initialization.Removing the emoji prefix aligns with the updated logger configuration pattern, maintaining consistency across the codebase.
166-166
: LGTM! Improved source logging structure.Using an object with a
source
key for child loggers enhances log readability and searchability.packages/legacy/utils/src/in-context-sdk.ts (2)
52-52
: LGTM! Structured source logging.Using an object with a
source
key for the raw source logger improves log clarity and consistency.
86-88
: LGTM! Enhanced SDK logging structure.The structured format for in-context SDK logging with the
inContextSdk
key improves log organization and readability.packages/transports/rest/src/directives/httpOperation.ts (1)
103-106
: LGTM! Enhanced logging clarity.The changes improve logging by:
- Using structured key-value pairs for better log parsing
- Removing unnecessary arrow symbol for cleaner output
packages/legacy/cli/src/index.ts (2)
46-46
: LGTM! Simplified logger prefix.Removing the emoji prefix makes logs cleaner and more consistent.
306-306
: LGTM! Enhanced logging configuration.Consistently passing the logger instance to
findAndParseConfig
ensures uniform logging behavior across different operations.Also applies to: 391-391, 460-460
packages/legacy/config/src/process.ts (3)
11-11
: LGTM! Added logger type and configuration option.The addition of the Logger type import and logger option to ConfigProcessOptions enhances type safety and configuration flexibility.
Also applies to: 65-65
223-223
: LGTM! Standardized structured logging.The changes consistently use object-based contexts for logging across sources, plugins, and handlers, improving log clarity and searchability.
Also applies to: 235-235, 379-379, 403-403, 415-415
561-562
: LGTM! Enhanced merger logging.The changes improve merger logging by:
- Using structured key-value pairs
- Consistently applying the same logging pattern as other components
Also applies to: 569-570
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-mesh/cache-cfw-kv |
0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cache-file |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cache-inmemory-lru |
0.0.12-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cache-localforage |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cache-redis |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cache-upstash-redis |
0.0.3-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/compose-cli |
1.3.10-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/fusion-composition |
0.7.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/include |
0.2.15-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/apollo-link |
0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/cli |
0.98.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/config |
0.106.22-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/graphql |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/grpc |
0.107.7-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/json-schema |
0.108.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/mongoose |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/mysql |
0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/neo4j |
0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/odata |
0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/openapi |
0.108.20-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/postgraphile |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/raml |
0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/soap |
0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/supergraph |
0.9.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/thrift |
0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/tuql |
0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/http |
0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/merger-bare |
0.104.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/merger-stitching |
0.104.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/migrate-config-cli |
1.4.14-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/runtime |
0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/store |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-cache |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-encapsulate |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-extend |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-federation |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-filter-schema |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-hive |
0.103.19-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-hoist-field |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-naming-convention |
0.103.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-prefix |
0.103.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-prune |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-rate-limit |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-rename |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-replace-field |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-resolvers-composition |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-transfer-schema |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transform-type-merging |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/types |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/urql-exchange |
0.105.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/utils |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/grpc |
0.2.4-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/json-schema |
0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/mysql |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/neo4j |
0.9.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/odata |
0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/openapi |
0.108.20-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/raml |
0.108.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/soap |
0.105.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/sqlite |
0.7.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@omnigraph/thrift |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-deduplicate-request |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-hive |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-http-cache |
0.104.4-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-http-details-extensions |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-jit |
0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-jwt-auth |
1.4.6-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-live-query |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-mock |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-newrelic |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-operation-field-permissions |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-operation-headers |
1.3.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-rate-limit |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-response-cache |
0.103.17-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-snapshot |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-statsd |
0.103.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-grpc |
0.2.6-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-mysql |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-neo4j |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-odata |
0.1.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-rest |
0.8.18-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-soap |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-sqlite |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/transport-thrift |
0.8.16-alpha-20250212143840-31f05e0058c8a194977f210671de19e8e0e43599 |
npm ↗︎ unpkg ↗︎ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
packages/legacy/utils/src/logger.ts (4)
78-78
: Standardize spacing after level indicators.There's inconsistent spacing after level indicators across different log methods:
[level=WARN]
(2 spaces)[level=INFO]
(2 spaces)[level=ERROR]
(1 space)[level=DEBUG]
(1 space)Apply this diff to standardize the spacing:
- `[timestamp=${getTimestamp()}] [level=WARN] ${this.prefix}${ANSI_CODES.orange}`, - `[timestamp=${getTimestamp()}] [level=INFO] ${this.prefix}${ANSI_CODES.cyan}`, + `[timestamp=${getTimestamp()}] [level=WARN] ${this.prefix}${ANSI_CODES.orange}`, + `[timestamp=${getTimestamp()}] [level=INFO] ${this.prefix}${ANSI_CODES.cyan}`,Also applies to: 88-88, 99-99, 110-110, 122-122
128-139
: Enhance TypeScript types and documentation.Consider adding JSDoc comments and more specific types for better developer experience.
Apply this diff:
- child(name: string | Record<string, string | number>): Logger { + /** + * Creates a child logger with additional context + * @param name - Logger context as string or key-value pairs + * @example + * // String context + * logger.child('UserService') + * // Key-value context + * logger.child({ userId: '123', action: 'login' }) + */ + child(name: string | { [K in string]: string | number }): Logger {
141-147
: Enhance TypeScript types and documentation for addPrefix.Similar to the child method, consider adding JSDoc comments and more specific types.
Apply this diff:
- addPrefix(prefix: string | Record<string, string | number>): Logger { + /** + * Adds a prefix to the current logger + * @param prefix - Prefix as string or key-value pairs + * @example + * // String prefix + * logger.addPrefix('Worker') + * // Key-value prefix + * logger.addPrefix({ workerId: '123' }) + */ + addPrefix(prefix: string | { [K in string]: string | number }): Logger {
154-163
: Enhance stringifyName function with validation and documentation.The function could be more robust with input validation and handle edge cases better.
Apply this diff:
+/** + * Formats a name into a log-friendly string + * @param name - String, number, or key-value pairs to format + * @returns Formatted string in [key=value] format + * @throws {Error} If name is null or undefined + */ function stringifyName(name: string | Record<string, string | number>) { + if (name == null) { + throw new Error('Name cannot be null or undefined'); + } + if (typeof name === 'string' || typeof name === 'number') { return `[${name}]`; } + + if (Object.keys(name).length === 0) { + throw new Error('Object cannot be empty'); + } + const names: string[] = []; for (const [key, value] of Object.entries(name)) { + if (value == null) { + throw new Error(`Value for key "${key}" cannot be null or undefined`); + } names.push(`${key}=${value}`); } return `[${names.join(', ')}]`; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/legacy/cli/src/commands/serve/serve.ts
(3 hunks)packages/legacy/types/src/index.ts
(1 hunks)packages/legacy/utils/src/logger.ts
(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/legacy/types/src/index.ts
- packages/legacy/cli/src/commands/serve/serve.ts
⏰ Context from checks skipped due to timeout of 90000ms (14)
- GitHub Check: integration / node 22
- GitHub Check: integration / node 20
- GitHub Check: e2e / node v22
- GitHub Check: integration / node 18
- GitHub Check: e2e / node v20
- GitHub Check: e2e / node v18
- GitHub Check: unit / node 22
- GitHub Check: unit / node 20
- GitHub Check: apollo-federation-compatibility
- GitHub Check: release / snapshot
- GitHub Check: unit / node 18
- GitHub Check: deployment
- GitHub Check: check
- GitHub Check: Analyze (javascript-typescript)
Logger
interface changes that exposed to the user in case of custom logging;child
method ofLogger
accepts an object.So in Hive Gateway we can implement our JSON-based logger.
DefaultLogger
text-based prettified logger implementation forLogger
interface;DefaultLogger
implementation prints key value pairs as[key=value]
[timestamp=XXX]
key=value
instead of single string such as[requestId=XXX]
Summary by CodeRabbit
New Features
Refactor