Skip to content
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

fix(gate): Improve logging and responses, prepare 0.4.1 #714

Merged
merged 13 commits into from
May 20, 2024

Conversation

Natoandro
Copy link
Contributor

@Natoandro Natoandro commented May 10, 2024

  • Logging before and after each faillible operation
    • Runtimes: foreign resolvers
  • Always log before reporting error: HTTP response
  • Fix error code in artifact_service
  • Add BaseError class for structured messages in responses

Summary by CodeRabbit

  • New Features

    • Updated Docker image versions and dependency versions to ensure compatibility and stability.
    • Added a search functionality to the app.
  • Bug Fixes

    • Enhanced error handling with specific error classes for more detailed error messages.
  • Refactor

    • Replaced generic Error instances with specific error classes for better error categorization.
    • Refactored error handling in HTTP response functions to use a BaseError class.
  • Chores

    • Updated version numbers across multiple configuration files to 0.4.1-0.

Copy link

linear bot commented May 10, 2024

@Natoandro Natoandro changed the base branch from main to chore/bump-0.4.1-0 May 10, 2024 12:13
@Natoandro Natoandro force-pushed the feat/met-533-fix-typegate-logging branch from 415e847 to 9aee04a Compare May 13, 2024 10:26
Base automatically changed from chore/bump-0.4.1-0 to main May 14, 2024 07:54
@Natoandro Natoandro changed the title fix(gate): Improve logging fix(gate): Improve logging and responses May 14, 2024
@Natoandro Natoandro marked this pull request as ready for review May 14, 2024 20:52
Copy link
Contributor

coderabbitai bot commented May 14, 2024

Walkthrough

The recent changes encompass updating version numbers across various configuration files to maintain consistency and compatibility with the new version 0.4.1-0. Notably, enhancements in error handling within the typegate project introduce specific error classes for improved error management and logging. Detailed logging improvements have been implemented across multiple runtime classes to offer more informative log messages.

Changes

Files Change Summary
.ghjk/lock.json, dev/lock.yml, ghjk.ts, meta-cli/Cargo.toml, ... Updated various version declarations to 0.4.1-0.
Cargo.toml, libs/common/Cargo.toml, libs/metagen/tests/mat_rust/Cargo.toml, ... Version updated from 0.4.0 to 0.4.1-0.
examples/templates/deno/compose.yml, examples/templates/node/compose.yml, ... Docker image version for typegate service updated to v0.4.1-0 from v0.4.0.
libs/metagen/Cargo.toml, libs/metagen/src/lib.rs, libs/metagen/src/tests/mod.rs Added color-eyre dependency, switched error handling from anyhow to color_eyre.
meta-cli/Cargo.toml, meta-cli/src/cli/upgrade.rs, meta-cli/src/cli/deploy.rs, ... Significant refactoring, restructuring, and logging improvements in various modules within meta-cli.
meta-cli/src/cli/typegate.rs, meta-cli/src/cli/serialize.rs, meta-cli/src/cli/ui/mod.rs, ... Refactored imports, error handling, and logging in different modules within meta-cli.
typegate/src/engine/computation_engine.ts, typegate/src/errors.ts, typegate/src/libs/jsonpath.ts, ... Introduced specific error classes for improved error management and logging within typegate.
typegate/src/runtimes/graphql.ts, typegate/src/runtimes/prisma/migration.ts, ... Enhanced logging with detailed statements and error handling improvements in various runtime classes.
typegate/src/services/artifact_service.ts, typegate/src/tests/rest/rest_test.ts, ... Improved error handling, logging, and error message updates in service modules and test cases within typegate.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Out of diff range and nitpick comments (1)
typegate/src/typegate/artifacts/shared.ts (1)

Line range hint 55-57: Remove or address the commented-out code for Node.js compatibility.

The commented-out code for Node.js compatibility should be either removed or properly addressed to avoid confusion.

- // TODO compatibility with Node.js streams?
- // const stream2 = stream.pipeThrough(new HashTransformStream(hasher));
- // ...

typegraph/core/src/global_store.rs Outdated Show resolved Hide resolved
typegate/src/runtimes/wasm_wire.ts Outdated Show resolved Hide resolved
typegate/src/runtimes/temporal.ts Show resolved Hide resolved
typegate/src/services/responses.ts Show resolved Hide resolved
typegate/src/services/responses.ts Show resolved Hide resolved
typegate/src/services/responses.ts Show resolved Hide resolved
Yohe-Am
Yohe-Am previously approved these changes May 14, 2024
typegate/src/runtimes/prisma/prisma.ts Show resolved Hide resolved
afmika
afmika previously approved these changes May 15, 2024
@Yohe-Am Yohe-Am dismissed stale reviews from afmika and themself via 4429158 May 17, 2024 03:01
Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 48.49138% with 239 lines in your changes are missing coverage. Please review.

Project coverage is 73.52%. Comparing base (bbdfd35) to head (9775e44).
Report is 1 commits behind head on main.

Files Patch % Lines
typegate/src/runtimes/s3.ts 0.00% 36 Missing ⚠️
typegate/src/runtimes/temporal.ts 0.00% 23 Missing ⚠️
typegate/src/errors.ts 80.35% 22 Missing ⚠️
typegate/src/runtimes/python.ts 0.00% 19 Missing ⚠️
typegate/src/runtimes/wasm_wire.ts 0.00% 15 Missing ⚠️
typegate/src/engine/query_engine.ts 58.82% 14 Missing ⚠️
typegate/src/runtimes/prisma/migration.ts 31.57% 13 Missing ⚠️
typegate/src/libs/jsonpath.ts 60.00% 12 Missing ⚠️
typegate/src/services/artifact_service.ts 20.00% 12 Missing ⚠️
typegate/src/typegate/artifacts/mod.ts 33.33% 12 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #714      +/-   ##
==========================================
- Coverage   74.05%   73.52%   -0.53%     
==========================================
  Files         120      120              
  Lines       13777    14142     +365     
  Branches     1407     1416       +9     
==========================================
+ Hits        10202    10398     +196     
- Misses       3549     3717     +168     
- Partials       26       27       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 29

Out of diff range and nitpick comments (9)
typegate/tests/runtimes/wasm_wire/rust/build.sh (1)

Line range hint 5-5: Replace pushd and popd with POSIX-compliant commands to ensure compatibility.

- pushd ..
+ cd ..
- popd
+ cd -

Also applies to: 7-7

meta-cli/src/deploy/push/migration_resolution.rs (1)

Line range hint 106-117: Consider improving error handling instead of using panic.

Using panic! in production code, especially in asynchronous operations, can lead to abrupt termination of the program which is generally undesirable. Consider using more graceful error handling mechanisms or propagating the error up the call stack.

typegate/tests/e2e/cli/dev_test.ts (1)

65-65: Ensure consistent logging format for better readability.

The logging statements use different formats which might lead to inconsistent logs. Consider standardizing the log format across your test cases for better readability and maintainability.

Also applies to: 102-102, 174-174

dev/test.ts (1)

238-245: Ensure consistent error reporting in test summaries.

The test summary reports use different formats for successful and failed tests. Consider using a consistent format to improve the readability of test results.

meta-cli/src/cli/gen.rs (2)

Line range hint 60-71: Consider handling the case where config.metagen is None more gracefully.

The current implementation uses pattern matching to handle the None case for config.metagen, but it immediately bails out with an error. It might be more user-friendly to provide a clearer error message or a suggestion on how to resolve the issue.


Line range hint 176-211: Review the error handling and logging in the load_tg_at function.

The function load_tg_at seems to have complex error handling and logging mechanisms. It would be beneficial to simplify these mechanisms to improve readability and maintainability.

meta-cli/src/deploy/actors/push_manager/state.rs (1)

3-3: Check for potential improvements in import management.

Consider organizing imports to improve readability and maintainability of the code.

meta-cli/src/deploy/push/pusher.rs (1)

Line range hint 129-160: Review the error handling and messaging in the finalize method.

The finalize method contains complex logic for handling different types of push failures. Simplifying this logic could improve readability and maintainability.

meta-cli/src/typegraph/loader/mod.rs (1)

Line range hint 73-183: Review the error handling and logging in the load_module and load_command methods.

The methods load_module and load_command contain complex error handling and logging mechanisms. Simplifying these mechanisms could improve readability and maintainability.

meta-cli/src/deploy/actors/loader.rs Show resolved Hide resolved
meta-cli/src/deploy/actors/loader.rs Show resolved Hide resolved
meta-cli/src/com/server.rs Show resolved Hide resolved
meta-cli/src/cli/doctor.rs Show resolved Hide resolved
meta-cli/src/typegraph/loader/discovery.rs Show resolved Hide resolved
meta-cli/src/logger.rs Show resolved Hide resolved
meta-cli/src/cli/new.rs Show resolved Hide resolved
meta-cli/src/config.rs Show resolved Hide resolved
meta-cli/src/config.rs Show resolved Hide resolved
meta-cli/src/cli/upgrade.rs Show resolved Hide resolved
zifeo
zifeo previously approved these changes May 17, 2024
Copy link
Member

@zifeo zifeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will likely have to improve log even better, what a super start 💪

meta-cli/Cargo.toml Show resolved Hide resolved
typegate/src/errors.ts Show resolved Hide resolved
- Fixes multi-typegraph deployment bug.
- Fixes issue with loader process existing after cli death.
- Replaces `anyhow` with `color-eyre` in cli and improved logging story.
- `interlude` pattern was used to minimize changes by wrapping `eyre`
through an `anyhow` export.
- [ ] Tests

MET-516
MET-517
MET-477

<!-- 5. Readiness checklist
- [ ] The change come with new or modified tests
- [ ] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
-->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Bug Fixes**
- Corrected typos in configuration files to ensure proper authentication
settings.

- **New Features**
- Enhanced error handling with improved context and logging for better
debugging.

- **Refactor**
- Updated dependencies and imports across multiple modules for
consistency and performance.
- Reorganized error handling to use `eyre` library for more descriptive
error messages.

- **Style**
- Standardized logging and error message formats for clarity and
uniformity.

- **Chores**
  - Updated platform compatibility in configuration files.
- Removed deprecated dependencies and added new ones to improve
functionality and maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@Yohe-Am Yohe-Am force-pushed the feat/met-533-fix-typegate-logging branch from 91d64d1 to 1bcf962 Compare May 20, 2024 02:26
@Yohe-Am Yohe-Am requested review from afmika and zifeo May 20, 2024 04:46
@Yohe-Am Yohe-Am changed the title fix(gate): Improve logging and responses fix(gate): Improve logging and responses, prepare 0.4.1 May 20, 2024
Copy link
Contributor Author

@Natoandro Natoandro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great 👍
LGTM

@zifeo zifeo merged commit de066d7 into main May 20, 2024
13 checks passed
@zifeo zifeo deleted the feat/met-533-fix-typegate-logging branch May 20, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants