Skip to content

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Oct 13, 2025

Description

This PR extends timechart command's per_* function support (introduced in #4464) by adding three additional per_* functions that normalize metrics to different time units:

  • per_minute(field): Calculates the per-minute rate (sum-per-second multiplies by 60)
  • per_hour(field): Calculates the per-hour rate (sum-per-second multiplies by 3600)
  • per_day(field): Calculates the per-day rate (sum-per-second multiplies by 86400)

TODO: After #4550 is resolved, migrate from the current second-based approach to millisecond-based calculations, e.g., timestampdiff(MILLISECOND, span_start, span_end) to support millisecond span.

Related Issues

Resolves #4350

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@dai-chen dai-chen self-assigned this Oct 13, 2025
@dai-chen dai-chen added enhancement New feature or request PPL Piped processing language backport 2.19-dev labels Oct 13, 2025
Signed-off-by: Chen Dai <[email protected]>
RyanL1997
RyanL1997 previously approved these changes Oct 16, 2025
Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

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

Hi @dai-chen , thanks for the change, and it is LGTM. Just left a very minor question on the doc format.

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

Labels

backport 2.19-dev enhancement New feature or request PPL Piped processing language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] PPL per_* aggregation function support

2 participants