GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — query: report the last node's query time and fix the percentage-view anomaly rate by stelfrag · Pull Request #24460 · netdata/netdata

Conversation

@stelfrag

@stelfrag stelfrag commented Oct 28, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Two query fixes for issues reported in #14797:

  • Per-node query time missing for the last node. rrd2rrdr() closed a node's duration only when the next node started, so the last (or only) node in summary.nodes[] never got its st.ms. The duration is now closed after the loop.
  • Anomaly rate wrong with options=percentage. The percentage conversion rebuilt the dimension view's anomaly_count by multiplying the averaged anomaly rate by the row count, which inflated sts.arp. It now uses the same formula as finalize and the cardinality limit.

Query corpus:

  • L5/anomaly-statistics-percentage and L5/summary-node-duration fail on master and pass with the fix.
  • The v2/v3 parity check now ignores summary.nodes[].st.ms, which is wall-clock time like the timings it already ignores.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected anomaly statistics in percentage-mode query results so reported anomaly rates are not scaled by the number of data rows.
    • Query summaries now report duration for every queried node, including the final node and queries with only one node. These durations are available alongside total query timing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@stelfrag
query: report the last node's query time and fix the percentage-view …
646468f
…anomaly rate

The per-node query time was stored only when the next node started, so the last node of every query had no ms. With options=percentage the per-dimension anomaly count was scaled by the row count instead of the dview multiplier, reporting sum(row rates)/10 instead of their mean. Corpus contracts cover both.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5884e97a-7fcd-4b87-8e86-de20e2a9203b
Commits

Reviewing files that changed from the base of the PR and between 77e14ca and 646468f.

Files selected for processing: 7
  • src/web/api/queries/query-group-by-finalize.c
  • src/web/api/queries/query.c
  • tests/query-corpus/MANIFEST.md
  • tests/query-corpus/anomalybit_test.go
  • tests/query-corpus/layer9_test.go
  • tests/query-corpus/manifest.json
  • tests/query-corpus/summary_nodes_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The query code changes how the v2 view calculates anomaly counts and records the final query node’s duration. Query-corpus tests and manifest cases cover percentage-mode anomaly statistics and per-node duration reporting.

Changes: Query reporting

Layer / File(s) Summary
Anomaly statistics
src/web/api/queries/query-group-by-finalize.c, tests/query-corpus/anomalybit_test.go, tests/query-corpus/manifest.json
The v2 view’s anomaly count now scales the accumulated anomaly rate instead of multiplying it by the row count. A test checks the arp statistics in percentage mode.
Node duration reporting
src/web/api/queries/query.c, tests/query-corpus/summary_nodes_test.go, tests/query-corpus/layer9_test.go, tests/query-corpus/MANIFEST.md, tests/query-corpus/manifest.json
rrd2rrdr records elapsed time for the final node. Tests check that node durations are positive and bounded by total query time. The API parity test excludes node durations from response comparisons.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • netdata/netdata#24369: Extends query-corpus coverage and changes query tests, which this PR continues with cases for anomaly statistics and node durations.

Suggested reviewers: vkalintiris, ktsaou

Merge Risk: Minimal · up to 64646

The change corrects percentage anomaly rates and final-node duration reporting. No material merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes both primary changes: reporting the final node's query time and correcting the percentage-view anomaly rate.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 5 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added area/docs area/web area/tests labels Oct 28, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 28, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stelfrag
stelfrag marked this pull request as ready for review October 28, 2026 23:16
@stelfrag
stelfrag requested review from a team, Ancairon, thiagoftsm and vkalintiris as code owners October 28, 2026 23:16
thiagoftsm
thiagoftsm approved these changes Oct 29, 2026
View reviewed changes

@thiagoftsm thiagoftsm left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

PR is running as expected. LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@stelfrag
stelfrag merged commit d05b8ed into netdata:master Oct 29, 2026
144 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@stelfrag
stelfrag deleted the fix-query-node-ms-anomaly-pct branch October 29, 2026 07:01
@stelfrag stelfrag mentioned this pull request Oct 30, 2026
Patch release 2.12.3 #24442
Merged
stelfrag added a commit to stelfrag/netdata that referenced this pull request Oct 30, 2026
@stelfrag
query: report the last node's query time and fix the percentage-view …
638e103
…anomaly rate (netdata#24460)

The per-node query time was stored only when the next node started, so the last node of every query had no ms. With options=percentage the per-dimension anomaly count was scaled by the row count instead of the dview multiplier, reporting sum(row rates)/10 instead of their mean. Corpus contracts cover both.

(cherry picked from commit d05b8ed)
Ferroin pushed a commit that referenced this pull request Nov 4, 2026
@stelfrag @Ferroin
query: report the last node's query time and fix the percentage-view …
6d5409d
…anomaly rate (#24460)

The per-node query time was stored only when the next node started, so the last node of every query had no ms. With options=percentage the per-dimension anomaly count was scaled by the row count instead of the dview multiplier, reporting sum(row rates)/10 instead of their mean. Corpus contracts cover both.

(cherry picked from commit d05b8ed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@thiagoftsm thiagoftsm thiagoftsm approved these changes
@Ancairon Ancairon Awaiting requested review from Ancairon Ancairon is a code owner
@vkalintiris vkalintiris Awaiting requested review from vkalintiris vkalintiris is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area/docs area/tests area/web

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@stelfrag @thiagoftsm
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.