Skip to content

fix: measure harvest intervals with a monotonic clock - #106

Open
Shubham-Padkonde wants to merge 1 commit into
newrelic:mainfrom
Shubham-Padkonde:fix/monotonic-harvest-intervals
Open

Shubham-Padkonde wants to merge 1 commit into
newrelic:mainfrom
Shubham-Padkonde:fix/monotonic-harvest-intervals

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Harvester currently measures elapsed time using the wall clock. If the clock moves backward by an hour between harvests, a five-second interval becomes a 3,605-second wait; moving it forward can trigger an immediate harvest.

Use time.monotonic() for interval accounting, leaving telemetry timestamps unchanged. An explicit None sentinel distinguishes the first interval from a valid zero clock reading. Regression tests simulate both directions of clock adjustment for metric/span-style and event-style batches.

Validation: all four new regression cases fail before the change and pass afterward. All 142 offline tests pass; Ruff lint/format and git diff --check pass. Eight live endpoint tests and network doctests were not validated because outbound API testing was unavailable in this environment.

@Shubham-Padkonde
Shubham-Padkonde requested a review from a team as a code owner October 3, 2026 05:15

This branch has not been deployed

No deployments
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