Skip to content

Feat: Add performance metrics and mb/s tracking#356

Merged
Aaron ("AJ") Steers (aaronsteers) merged 4 commits into
mainfrom
aj/feat/improved-perf-logging
Sep 2, 2024
Merged

Feat: Add performance metrics and mb/s tracking#356
Aaron ("AJ") Steers (aaronsteers) merged 4 commits into
mainfrom
aj/feat/improved-perf-logging

Conversation

@aaronsteers

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented Sep 2, 2024

Copy link
Copy Markdown
Member

Example output printed to log files:

Metrics from Faker to a local DuckDB cache:

{
    "read_performance_metrics": {
        "job_description": {
            "description": "source-faker -> DuckDBCache",
            "source": "source-faker",
            "cache": "DuckDBCache"
        },
        "total_records_read": 200100,
        "read_start_time": 1725301258.959898,
        "read_end_time": 1725301282.203239,
        "records_per_second": 9252.684942052056,
        "mb_read": 92.544833,
        "mb_per_second": 4.2793,
        "stream_metrics": {
            "products": {
                "records_read": 100,
                "read_start_time": 1725301260.57727,
                "read_end_time": 1725301260.579796,
                "read_time_seconds": 0.0025260448455810547,
                "records_per_second": 39587.57904672015,
                "mb_read": 0.023553,
                "mb_per_second": 9.3241
            },
            "users": {
                "records_read": 100000,
                "read_start_time": 1725301261.9061,
                "read_end_time": 1725301273.219753,
                "read_time_seconds": 11.313652992248535,
                "records_per_second": 8838.878129682274,
                "mb_read": 60.902998,
                "mb_per_second": 5.3831
            },
            "purchases": {
                "records_read": 100000,
                "read_start_time": 1725301274.128414,
                "read_end_time": 1725301282.041147,
                "read_time_seconds": 7.91273307800293,
                "records_per_second": 12637.858375129052,
                "mb_read": 31.618282,
                "mb_per_second": 3.9959
            }
        }
    }
}

Metrics from e2e source to e2e destination, with caching disabled:

{
    "read_performance_metrics": {
        "job_description": {
            "description": "source-e2e -> destination-e2e-test",
            "source": "source-e2e",
            "destination": "destination-e2e-test"
        },
        "total_records_read": 240000,
        "read_start_time": 1725301176.394967,
        "read_end_time": 1725301184.583842,
        "records_per_second": 36316.86986395221,
        "mb_read": 62.88,
        "mb_per_second": 9.515,
        "stream_metrics": {
            "stream1": {
                "records_read": 240000,
                "read_start_time": 1725301177.975788,
                "read_end_time": null
            }
        }
    }
}

We also print MB/s in live progress tracking:

image

Summary by CodeRabbit

  • New Features

    • Introduced progress tracking for data processing, allowing users to monitor bytes read during execution.
    • Added new metrics for byte-level performance, including total bytes and megabytes read.
    • Enhanced logging to include byte metrics upon successful sync operations.
  • Bug Fixes

    • Improved the _read_with_catalog function to support progress tracking, enhancing usability during data reading processes.

@coderabbitai

coderabbitai Bot commented Sep 2, 2024

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

Aaron ("AJ") Steers (@aaronsteers) has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 33 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between d7076c9 and ca28627.

Walkthrough

Walkthrough

The changes introduce a progress tracking feature across multiple components of the Airbyte codebase. The _execute method in the connector class now accepts a progress_tracker parameter, enhancing its ability to monitor execution progress. The Progress module has been updated to include new properties and methods for byte-level tracking, while the _read_with_catalog function in the sources module has been modified to incorporate progress tracking during data reading.

Changes

File Path Change Summary
airbyte/_connector_base.py Added progress_tracker parameter to _execute method to enable progress tracking during execution.
airbyte/progress.py Introduced byte-level tracking with new properties and methods, including tally_bytes_read. Expanded logging of performance metrics.
airbyte/sources/base.py Modified _read_with_catalog function to include progress_tracker for tracking during reading.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Connector
    participant ProgressTracker
    participant Source

    User->>Connector: Start execution
    Connector->>ProgressTracker: Initialize progress tracking
    Connector->>Source: Read data
    Source->>Connector: Yield record
    Connector->>ProgressTracker: Tally bytes read
    Connector->>User: Provide execution status
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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

@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

Outside diff range, codebase verification and nitpick comments (4)
airbyte/_connector_base.py (1)

356-357: Signature change looks good. Consider updating the docstring?

The new progress_tracker parameter is well-integrated into the method signature. Great job on making it a keyword-only argument with proper type hinting!

Would you like to update the method's docstring to include information about the new progress_tracker parameter? This could help other developers understand its purpose and usage. What do you think?

airbyte/sources/base.py (1)

Line range hint 1-1: Consider enhancing error handling with progress tracking. Thoughts?

The integration of the progress_tracker looks good overall. To further improve its usage, wdyt about:

  1. Adding more granular progress updates within long-running operations?
  2. Enhancing error handling to provide more detailed progress information when exceptions occur?

These changes could provide more insights into the execution process and make debugging easier. What do you think?

airbyte/progress.py (2)

243-269: New byte tracking properties and methods look great!

The additions provide a comprehensive set of tools for tracking and accessing byte-level metrics. The implementation is consistent with the existing code style and looks correct.

One small suggestion: Have you considered adding type hints for the return values of total_bytes_read and total_megabytes_read? It might improve code readability. For example:

def total_bytes_read(self) -> int | None:
    ...

def total_megabytes_read(self) -> float | None:
    ...

What do you think? This is just a minor suggestion, and the current implementation is already good.


432-489: Expanded _log_read_metrics looks great!

The addition of byte-related metrics significantly enhances the logging functionality. The implementation is well-structured and consistent with the existing code style.

One small suggestion: Have you considered adding a try-except block around the JSON dumping operation? This could help handle potential serialization errors gracefully. For example:

try:
    self._file_logger.info(json.dumps({"read_performance_metrics": perf_metrics}))
except json.JSONEncodeError as e:
    self._file_logger.error(f"Failed to serialize performance metrics: {e}")

What do you think? This is just a suggestion for added robustness, and the current implementation is already good.

Comment thread airbyte/_connector_base.py
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.

1 participant