Skip to content

Conversation

@kewang1024
Copy link
Collaborator

== NO RELEASE NOTE ==

@kewang1024 kewang1024 requested review from a team as code owners November 10, 2025 22:37
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Nov 10, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 10, 2025

Reviewer's Guide

This PR expands PrestoExchangeSource to collect and expose three new runtime metrics—getData latency, getDataSize latency, and page size—by adding dedicated metric fields, updating processDataResponse to record values, and modifying the metrics() method to include them when available.

File-Level Changes

Change Details Files
Introduce new runtime metric fields
  • Declared getDataMetric_, getDataSizeMetric_, and pageSizeMetric_ in the class
  • Initialized each metric with appropriate time or byte units
presto-native-execution/presto_cpp/main/PrestoExchangeSource.h
Record values for the new metrics in response processing
  • Add getDataSizeMetric_.addValue using retry duration for size requests
  • Add getDataMetric_.addValue using retry duration for data requests
  • Add pageSizeMetric_.addValue using totalBytes for data pages
presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp
Expose new metrics in metrics() override
  • Initialize result map instead of returning a literal
  • Conditionally insert getDataMs, getDataSizeMs, and pageSizeBytes into the map if count>0
  • Return the extended result map
presto-native-execution/presto_cpp/main/PrestoExchangeSource.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The metric names like "prestoExchangeSource.getDataMs" suggest milliseconds but you're storing nanosecond values (kNanos) — consider renaming them to "getDataNs" or converting the values to ms to avoid confusion.
  • You only include the new metrics in the map when count > 0; consider always emitting them (with zero values) so downstream consumers can rely on a consistent metric schema.
  • Instead of multiplying durationMs by 1'000'000 to convert to nanoseconds, consider using std::chrono::duration_cast for more precise and robust unit conversion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The metric names like "prestoExchangeSource.getDataMs" suggest milliseconds but you're storing nanosecond values (kNanos) — consider renaming them to "getDataNs" or converting the values to ms to avoid confusion.
- You only include the new metrics in the map when count > 0; consider always emitting them (with zero values) so downstream consumers can rely on a consistent metric schema.
- Instead of multiplying durationMs by 1'000'000 to convert to nanoseconds, consider using std::chrono::duration_cast for more precise and robust unit conversion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@kewang1024 kewang1024 force-pushed the runtime-stats branch 2 times, most recently from fdeb702 to a26e723 Compare November 11, 2025 01:35
@kewang1024 kewang1024 requested a review from arhimondr November 11, 2025 06:47
std::unique_ptr<http::HttpResponse> response,
bool isGetDataSizeRequest) {
if (isGetDataSizeRequest) {
getDataSizeMetric_.addValue(
Copy link
Member

Choose a reason for hiding this comment

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

The max will always be 10s (equal to the long pool duration). We need to substract the time request is waiting for long pool to make it meaningful.

@kewang1024 kewang1024 force-pushed the runtime-stats branch 3 times, most recently from 670089f to 28cae2b Compare November 13, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:Meta PR from Meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants