Skip to content

Feat: Enable logging when new stream starts#288

Merged
Aaron ("AJ") Steers (aaronsteers) merged 7 commits into
airbytehq:mainfrom
vspanxcode:bug-fx
Jul 8, 2024
Merged

Feat: Enable logging when new stream starts#288
Aaron ("AJ") Steers (aaronsteers) merged 7 commits into
airbytehq:mainfrom
vspanxcode:bug-fx

Conversation

@vspanxcode

@vspanxcode vspanxcode (vspanxcode) commented Jul 2, 2024

Copy link
Copy Markdown
Contributor

Related to : #229

New Outcome when we read from source
Screenshot 2024-07-02 at 9 23 52 PM

Summary by CodeRabbit

  • Enhancements
    • Improved tracking and logging of stream reading events for better monitoring and debugging.

@coderabbitai

coderabbitai Bot commented Jul 2, 2024

Copy link
Copy Markdown
Contributor
Walkthrough

Walkthrough

The main changes are in the airbyte/sources/base.py file, which introduces a new attribute _stream_names_observed to the BaseSource class. This attribute is used to track observed stream names. The _execute method is updated to log stream reading start events using a new method _log_stream_read_start. Additionally, unit tests in test_lowcode_connectors.py were improved with a new assertion message for better clarity on test failures.

Changes

File(s) / Group Change Summary
airbyte/sources/base.py Added _stream_names_observed, updated _execute to track logs, and added _log_stream_read_start method.
tests/unit_tests/test_lowcode_connectors.py Updated test_nocode_execution function to include an assertion message for better clarity on test failures.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BaseSource
    participant Logger
    
    User->>BaseSource: Call _execute(args)
    BaseSource->>BaseSource: Start executing stream
    BaseSource->>Logger: Log stream read start event (_log_stream_read_start)
    Logger-->>BaseSource: Event logged
    BaseSource-->>User: Yield AirbyteMessages
Loading

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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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.

@aaronsteers

Aaron ("AJ") Steers (aaronsteers) commented Jul 7, 2024

Copy link
Copy Markdown
Member

/fix-pr

Auto-Fix Job Info

This job attempts to auto-fix any linting or formating issues. If any fixes are made,
those changes will be automatically committed and pushed back to the PR.
(This job requires that the PR author has "Allow edits from maintainers" enabled.)

PR auto-fix job started... Check job output.

✅ Changes applied successfully.

@aaronsteers

Aaron ("AJ") Steers (aaronsteers) commented Jul 7, 2024

Copy link
Copy Markdown
Member

/test-pr

PR test job started... Check job output.

❌ Tests failed.

@aaronsteers

Copy link
Copy Markdown
Member

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Jul 7, 2024

Copy link
Copy Markdown
Contributor
Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread airbyte/sources/base.py Outdated
@aaronsteers

Copy link
Copy Markdown
Member

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Jul 7, 2024

Copy link
Copy Markdown
Contributor
Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cb0153e and e60ba39.

Files selected for processing (1)
  • airbyte/sources/base.py (3 hunks)
Additional comments not posted (3)
airbyte/sources/base.py (3)

78-78: LGTM!

The addition of the _last_stream_processed attribute is a good approach to track the last processed stream.


627-629: LGTM!

The _log_stream_read_start method correctly logs the commencement of reading a stream.


586-588: LGTM!

The integration of _last_stream_processed and the call to _log_stream_read_start within the _execute method is correct.

Comment thread airbyte/sources/base.py Outdated
Comment thread airbyte/sources/base.py Outdated
@aaronsteers

Aaron ("AJ") Steers (aaronsteers) commented Jul 7, 2024

Copy link
Copy Markdown
Member

/test-pr

PR test job started... Check job output.

❌ Tests failed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e60ba39 and 364e43e.

Files selected for processing (1)
  • airbyte/sources/base.py (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • airbyte/sources/base.py

@aaronsteers

Copy link
Copy Markdown
Member

Looks like an unrelated CI test failure:

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 364e43e and 65a455b.

Files selected for processing (2)
  • airbyte/sources/base.py (3 hunks)
  • tests/unit_tests/test_lowcode_connectors.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • tests/unit_tests/test_lowcode_connectors.py
Additional comments not posted (2)
airbyte/sources/base.py (2)

78-78: LGTM!

The attribute _stream_names_observed is correctly initialized as an empty set to track unique stream names.


627-629: LGTM!

The method _log_stream_read_start correctly logs the start of stream reading events with the current time.

Comment thread airbyte/sources/base.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@aaronsteers

Aaron ("AJ") Steers (aaronsteers) commented Jul 8, 2024

Copy link
Copy Markdown
Member

/test-pr

PR test job started... Check job output.

❌ Tests failed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 65a455b and 5f55604.

Files selected for processing (1)
  • airbyte/sources/base.py (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • airbyte/sources/base.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests are passing and it looks like this is ready to go!

Thanks, vspanxcode (@vspanxcode) for this contribution! 🙌

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit aea02e1 into airbytehq:main Jul 8, 2024
@marcosmarxm

Copy link
Copy Markdown
Contributor

vspanxcode (@vspanxcode) can you please contact me on Airbyte Slack or email marcos (at) airbyte.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants