ComposioHQ / composio

Composio equip's your AI agents & LLMs with 100+ high-quality integrations via function calling
https://docs.composio.dev
Other
8.76k stars 3.24k forks source link

Init sentry only when the user is logged in #548

Closed angrybayblade closed 3 weeks ago

github-actions[bot] commented 1 month ago

This comment was generated by github-actions[bot]!

JS SDK Coverage Report

📊 Coverage report for JS SDK can be found at the following URL: https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/coverage-10825436698/coverage/index.html

📁 Test report folder can be found at the following URL: https://pub-92e668239ab84bfd80ee07d61e9d2f40.r2.dev/html-report-10825436698/html-report/report.html

utkarsh-dixit commented 1 month ago

PR Summary

Changes: This pull request introduces some fixes and improvements in the Composio project:

  1. Conditional Sentry Initialization: Sentry will now only be initialized if the user is logged in. This ensures that we do not unnecessarily initiate Sentry services for non-logged in users.
  2. Improved Error Logging: Changed error logging from self.logger.info to self.logger.error in certain parts of the code to better indicate severity.
  3. Code Cleanup: The import statements have been repositioned to comply with clean code practices.

File Changes:

Objective: The primary objective of this PR is to optimize the Sentry initialization process and enhance error logging for better debugging and maintenance.

himanshu-dixit commented 1 month ago

PR Changes Summary

himanshu-dixit commented 1 month ago

PR Summary

Objective: This PR aims to ensure that Sentry is only initialized when the user is logged in.

Changes:

  1. Fix Initialization Logic: Moved Sentry initialization logic to only occur when user data is present in the system's .composio directory. This check is performed by trying to read and parse a user_data.json file.
  2. Error Handling: Improved error handling in the _handle_callback function of collections.py by changing logging from info to error level when exceptions occur.
  3. Import Ordering: Adjusted import positions in the __init__.py file to comply with Pylint guidelines.

Change Files:

PR Type: Fix

himanshu-dixit commented 1 month ago

Changes Summary

PR Objective: This pull request aims to fix the initialization of Sentry to only occur when the user is logged in and address import positions for better readability.

Changes of this PR:

  1. Initialization of Sentry:
    • Moved Sentry initialization inside a check to ensure it only runs if the user is logged in.
    • Introduced a helper function _hook() that verifies the existence of a user data file and loads the API key if present.
  2. Improved Logging:
    • Changed logging levels from info to error in python/composio/client/collections.py to better reflect the severity of exceptions in callbacks.
  3. Import Positioning:
    • Improved import positions by moving them to the top of the file as per Python conventions.

Categorization:

Type: Fix

Important Change Files:

  1. python/composio/__init__.py
  2. python/composio/client/collections.py
himanshu-dixit commented 1 month ago

Changes Summary

Objective: This PR addresses initializing sentry_sdk only when the user is logged in and fixes import positions in the __init__.py file.

Changes:

Change Type: Fix

Important Files Changed:

These changes improve upon the stability of error monitoring initialization and adhere to better code organization and logging practices.

tanner-chiang commented 1 month ago

PR Summary

Changes:

Type: Fix

Key Changes: (Improvement to Sentry Initialization & Import Positioning)

  1. File: python/composio/__init__.py
    • Added a _hook() function to ensure Sentry SDK initialization happens only when user data is present, thereby improving efficiency.
    • Adjusted import positions for json, sentry_sdk, and Path to avoid import errors.
  2. File: python/composio/client/collections.py
    • Changed logger from info to error for exceptions raised in _handle_callback method to ensure proper logging of errors.

These changes are intended to be more effective resource utilization by initializing Sentry only when needed and improving the readability and maintainability of the import statements. Proper logging improvements have also been ensured for better issue tracking.

robert3lee commented 1 month ago

Changes Summary of PR #548

Objective: This PR aims to ensure that Sentry is only initialized when the user is logged in to prevent unnecessary error tracking and improve application performance.

Type: Fix

Change Files:

  1. python/composio/__init__.py
  2. python/composio/client/collections.py

Detailed Changes:

  1. Init Sentry only when user is logged in:
    • Modified python/composio/__init__.py to include a check for user login status before initializing Sentry.
    • Added a function _hook that verifies the existence of user_data.json and checks for api_key before initializing Sentry.
  2. Log error instead of info:
    • Updated python/composio/client/collections.py to log errors instead of info for callback execution issues.
  3. Import position adjustments:
    • Adjusted the import positions in python/composio/__init__.py for better readability and compliance with standards.

Please review these changes carefully to ensure they meet the project's requirements and standards. If there are any issues or suggestions, feel free to comment below. Thank you!

robert3lee commented 1 month ago

PR Changes Summary

Objective:

This PR aims to improve the initialization logic for Sentry and correct the logging level utilized within the callback handling in the collections module.

Changes:

Important Files Changed:

Type: Fix


Please review the changes carefully and provide your feedback.

shudhatma1995 commented 3 weeks ago

PR Summary

Objective: This PR aims to improve how Sentry (an error tracking tool) is initialized, ensuring that it is only set up when the user is logged in. Additionally, it improves the overall structure and logging of Sentry-related operations.

Changes:

  1. Initialization of Sentry:

    • Moved the Sentry initialization code to trigger only when the user is logged in.
    • Previously, the initialization happened irrespective of user login status.
  2. Refactoring Code:

    • Split the Sentry code into a separate utility module sentry.py.
    • Removed in-line imports and structured them at the top of the file.
  3. Error Logging:

    • Enhanced error logging to use logger.error instead of logger.info for better visibility of exceptions.
  4. File Modifications:

    • python/composio/__init__.py: Significant restructuring to move Sentry-related code to a new module.
    • python/composio/client/collections.py: Minor fix changing error logging level.
    • python/composio/utils/sentry.py: A new file created to encapsulate Sentry-related utilities and initialization logic.

Category:

Important Change Files:

  1. python/composio/__init__.py
  2. python/composio/client/collections.py
  3. python/composio/utils/sentry.py
mjschock commented 2 weeks ago

Pull Request Summary

Changes Introduced:

Objective

The primary objective of this PR is to ensure that Sentry is only initialized when a user is logged in and to clean up the Sentry initialization process by moving it to a separate utility file for better maintenance and readability.

mjschock commented 2 weeks ago

PR Summary

Objective: This PR aims to improve the integration of Sentry for error logging by ensuring it is initialized only when the user is logged in. Additionally, it refactors the Sentry initialization logic to a separate utility file for improved code management.

Changes:

  1. Sentry Initialization Logic:

    • The Sentry SDK is now only initialized if the user data file exists and contains valid data.
    • Moved Sentry initialization logic to a new utility file utils/sentry.py.
  2. Error Handling Improvements:

    • Changed logger in collections.py from info to error for better logging of critical issues.
  3. Code Organization:

    • Import statements are reorganized to follow proper conventions.
    • Consolidated error handling related to Sentry initialization to utils/sentry.py.

Change Type:

Major Change Files:

vdteixeira commented 1 week ago

PR Summary

PR URL: https://github.com/ComposioHQ/composio/pull/548 PR Type: Fix

Objective:

The objective of this PR is to enhance the Sentry logging mechanism within the composio Python package. The primary goal is to ensure that Sentry is initialized only when the user is logged in, among other improvements.

Changes:

  1. Initialization of Sentry:

    • Moved Sentry initialization to a dedicated sentry.py module.
    • Implemented a check to initialize Sentry only if the user's api_key is present in the .composio/user_data.json file.
    • Added functions to fetch Sentry DSN and configuration dynamically.
  2. Position of Imports:

    • Adjusted import positions in __init__.py to follow proper order and patterns.
  3. Error Logging:

    • Updated logging from info to error for better visibility when exceptions occur.

Important Files with Major Changes:

  1. python/composio/__init__.py:
    • Refactored to import Sentry configurations and initializations from sentry.py.
  2. python/composio/client/collections.py:
    • Updated logger error handling for better accuracy in log messages.
  3. python/composio/utils/sentry.py:
    • Newly created file to handle all Sentry-related initializations and operations.

This PR focuses on stabilizing the Sentry logging mechanism, ensuring it initializes correctly based on the user's logged-in state.