Skip to content

CA-408126 - rrd: Do not lose ds_min/max when adding to the RRD #6349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

last-genius
Copy link
Contributor

Rrd.ds_create has optional min and max arguments (defaulting to neg_infinity and infinity respectively). Several callers would omit these parameters, resulting in ds_min and ds_max being lost during the conversion from Ds.ds to Rrd.ds. Without these, metrics couldn't be kept in range, which would result in some (such as CPU usage numbers) going negative when a domain would change its domid (over a reboot), for example.

Make these parameters required, not optional. Requires adjusting unit tests as well.

This latent behaviour was exposed during the major timestamp and plugin refactoring last year.
Previously, the entire RRD was created at once by calling create_fresh_rrd. Now create_fresh_rrd is only called for the first chunk, and other chunks of the RRD call merge_new_dss, which omitted the optional arguments. Rrdd_server.add_ds also ommitted these arguments, which meant that datasources enabled at runtime would not be kept in range.

@last-genius last-genius marked this pull request as ready for review March 10, 2025 15:35
@last-genius
Copy link
Contributor Author

I've tested this manually and it seems to fix the negative cpu usage issue, both in XC and rrd2csv.

@last-genius last-genius changed the title XSI-1833 - rrd: Do not lose ds_min/max when adding to the RRD CA-408126 - rrd: Do not lose ds_min/max when adding to the RRD Mar 10, 2025
@last-genius last-genius force-pushed the private/asultanov/CA-408126 branch from 4e5abf7 to 1e05577 Compare March 10, 2025 15:37
@last-genius last-genius force-pushed the private/asultanov/CA-408126 branch from 1e05577 to 2946f0b Compare March 10, 2025 16:25
Rrd.ds_create has optional min and max arguments (defaulting to neg_infinity
and infinity respectively). Several callers would omit these parameters,
resulting in ds_min and ds_max being lost during the conversion from Ds.ds to
Rrd.ds. Without these, metrics couldn't be kept in range, which would result in
some (such as CPU usage numbers) going negative when a domain would change
its domid (over a reboot), for example.

Make these parameters (alobg with mrhb) required, not optional. Requires
adjusting unit tests as well.

This latent behaviour was exposed during the major timestamp and plugin
refactoring last year.
Previously, the entire RRD was created at once by calling create_fresh_rrd. Now
create_fresh_rrd is only called for the first chunk, and other chunks of the
RRD call merge_new_dss, which omitted the optional arguments.
Rrdd_server.add_ds also ommitted these arguments, which meant that datasources
enabled at runtime would not be kept in range.

Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
@last-genius last-genius force-pushed the private/asultanov/CA-408126 branch from 2946f0b to 71f8d16 Compare March 10, 2025 16:25
@edwintorok edwintorok added this pull request to the merge queue Mar 10, 2025
Merged via the queue into xapi-project:master with commit 182528a Mar 10, 2025
17 checks passed
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.

4 participants