Repository navigation
Conversation
When a chart is reset after a long collection gap, the reset cleared the collection count of the sample that triggered it, so the next sample was treated as a baseline too and its increase was lost (netdata#25215). The reset now keeps the returning sample as the first of the new collection and drops what belongs before the gap: the unstored remainder, the last stored value and ML's prediction window. The "too old data" branch restarts the chart clock at the returning sample, a v1 parent is told to measure the gap itself, and incremental-row percentages ignore dimensions at their first value.
The v1 BEGIN without a duration is now decided by the reset itself and passed to the sender, instead of through resync_time_s, which sender and replication threads also write. The incremental-row denominator keeps its original arithmetic, over the dimensions past their first value. The reset's ML notices are one chart statistics update, like a slot.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Architecture diagram
sequenceDiagram
participant Collector as Collector (Plugin)
participant Parser as pluginsd Parser
participant RRDSet as rrdset_timed_done()
participant RRDDim as Dimension (rrddim)
participant ML as ML Engine
participant Store as Storage Engine (dbengine)
participant Stream as Streaming Buffer
Note over Collector,Stream: Collection Gap Reset Flow
Collector->>Parser: SET dimension values
Parser->>RRDSet: END chart (with collected values)
RRDSet->>RRDSet: Detect gap timeout or stale clock
RRDSet->>RRDSet: rrdset_collection_reset(st, now)
Note over RRDSet,RRDDim: NEW: Returning sample becomes baseline
RRDSet->>RRDDim: For each updated dimension
RRDDim->>RRDDim: CHANGED: Set counter=1 (keep as baseline)
RRDDim->>RRDDim: NEW: Clear last_calculated_value
RRDDim->>RRDDim: NEW: Set last_stored_value=NAN
Note over RRDDim,ML: NEW: Missing point notification for ML
RRDSet->>ML: ml_chart_update_begin(st)
RRDSet->>RRDDim: For each dimension
RRDDim->>ML: ml_dimension_is_anomalous(rd, now.tv_sec, 0, false)
RRDSet->>ML: ml_chart_update_end(st)
RRDSet->>Store: storage_engine_store_flush() for each tier
alt Reset via long gap (timeout)
RRDSet->>RRDSet: Set usec_since_last_update
RRDSet->>RRDSet: store_this_entry=0, first_entry=1
else Reset via too-old data
RRDSet->>RRDSet: CHANGED: Restart clock at returning sample
RRDSet->>RRDSet: Set usec_since_last_update
end
Note over RRDSet,Stream: CHANGED: percentage-of-incremental-row calculation
RRDSet->>RRDSet: Compute incremental_collected_total
RRDSet->>RRDSet: Exclude baseline dimensions from totals
RRDSet->>Stream: stream_send_rrdset_metrics_v1(rsb, st, reset)
alt reset == true AND streaming v1
Stream->>Stream: NEW: Send BEGIN "<chart>" 0 (no duration)
Note over Stream: Parent measures elapsed time itself
else streaming v2
Stream->>Stream: Send metrics as usual (unchanged)
end
Stream-->>Collector: Confirmation (via normal flow)
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
The gap cases checked only the sum of the rates stored after the gap, so a missing or misplaced slot could pass. Each case now requires one point at every slot of the samples after the gap, and the chart's last point at the last of them.
|
Problem
When a chart is not collected for long enough,
rrdset_timed_done()resets it (under dbengine, a gap of more than 60 ×update_every, for example a suspended host or a stalled collector). The reset cleared the collection count of the sample that triggered it, so the next sample was treated as another baseline and the first increase after the gap was lost: a counter that returns as 5000, then 5001, stored no event (#25215). The "too old data" reset also cleared the chart clock after the returning sample had set it.Change
/api/v1/allmetricsshows no value for the returning dimension until its next point). ML gets a best-effort missing-point notice, so its prediction window does not span the gap.BEGIN "<chart>" 0, so the parent measures the elapsed time with its own clock.percentage-of-incremental-rowleaves dimensions that are taking a baseline out of the row total; when every updated dimension has a baseline, the arithmetic is unchanged.Compatibility
percentage-of-incremental-rowvalues change only on a collection where a dimension is taking its baseline.Testing
-W pluginsd-sample-timesadds seven gap cases (both reset paths with and withoutstore_first, a remainder from before the gap, a dimension missing the returning sample, incremental-row percentages). They fail on master and pass with the fix.-W unittestpasses.Fixes #25215
Summary by cubic
Fixes the collection-gap reset so the returning sample is kept as the new baseline and the first increase after a gap is no longer lost. Previously the reset cleared the returning sample's collection count, so the next sample was treated as another baseline and the increase was dropped (#25215).
Side effects
BEGIN "<chart>" 0so the parent measures elapsed time with its own clock; the v2 protocol is unchanged.percentage-of-incremental-rowexcludes dimensions taking a baseline from the row total.Written for commit 5bad18a. Summary will update on new commits.
Summary by CodeRabbit