Uh oh!
There was an error while loading. Please reload this page.
feat(runtime): Update pollrate behavior and add tests for it - #890
Open
CagriYonca wants to merge 2 commits into
Open
feat(runtime): Update pollrate behavior and add tests for it#890CagriYonca wants to merge 2 commits into
CagriYonca wants to merge 2 commits into
Conversation
CagriYonca
marked this pull request as draft
August 7, 2026 12:48
CagriYoncaforce-pushed
the
pollrate-new-metrics
branch
2 times, most recently
from
August 11, 2026 15:09
457617c to
b7ce752CompareSigned-off-by: Cagri Yonca <cagri@ibm.com>
…esponding metrics. Signed-off-by: Cagri Yonca <cagri@ibm.com>
CagriYoncaforce-pushed
the
pollrate-new-metrics
branch
from
August 11, 2026 15:15
b7ce752 to
07c716cCompareCagriYonca
marked this pull request as ready for review
August 11, 2026 17:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The tracer previously capped
poll_rateto a maximum of5seconds,silently resetting any higher value back to
1. This prevented customersfrom benefiting from coarser poll rates (e.g.
60 s,120 s) to reduceobservability cost.
Additionally, GC metrics were collected using
gc.get_count()andgc.get_threshold(), which do not reflect actual GC activity. The correctsource is
gc.get_stats(), which tracks cumulativecollections,collected, anduncollectablecounters per generation — consistent withthe OpenTelemetry CPython semantic conventions
(
cpython.gc.collections,cpython.gc.collected_objects,cpython.gc.uncollectable_objects) and theOpenTelemetry Python contrib
system_metricsinstrumentation,both of which source these metrics from
gc.get_stats().Finally, the host agent timeout detection used a fixed 60-second window,
causing spurious disconnects when
poll_rateexceeded 30 seconds.What
options.py: ReplacedMAX_POLL_RATE = 5with aVALID_POLL_RATESlist
[1, 5, 10, 20, 30, 60, 120, 180, 240, 300, 360, 420, 480, 540, 600].set_poll_rate()now rounds to the nearest valid value instead ofrejecting anything outside
{1, 5}.runtime.py: Switched GC collection fromgc.get_count()/gc.get_threshold()togc.get_stats(). Reports per-generation deltasfor
collections,collected, anduncollectable(keysgc.collections0-2,gc.collected0-2,gc.uncollectable0-2).host.py: Timeout window is nowmax(60, poll_rate * 2)seconds toavoid false resets at high poll rates. Added
_send_heartbeat()— alightweight
HEADrequest sent when no metrics/spans/profiles areproduced in a cycle, keeping
last_seencurrent between polls.Testing
Unit tests are included for all changed behaviours in:
tests/test_options.py,tests/collector/helpers/test_collector_runtime.py,tests/collector/test_host_collector.py,tests/agent/test_host.py