Repository navigation
compare_analysis sigma-bands the v2 PostgreSQL baselined metrics — I/O read latency, replay lag, WAL volume — so a 16× latency move stops reading by the ladder alone; the write family has one definition of "WAL tracked" (partial #3691) - #3748
Merged
Merged
Conversation
… definition of WAL tracked (partial #3691) ComparisonBanding maps PG_IO_READ_LATENCY_MS -> pg_io_read_latency (value), PG_REPLICATION_LAG -> pg_replay_lag_bytes (value) and PG_WAL_VOLUME_SHIFT -> pg_wal_bytes_per_sec (its peak_wal_bytes_per_sec, the reading the detector judges; value_delta stays the mean). Unavailable shapes are withheld through BaselinedValueFor and take the absolute rule with the bucket still named. PgTargetFactCollector.Write.cs: WalIsTracked(anyNonNull, bytes, records) is the one trackedness decision for both the checkpoint and WAL-volume reads; the checkpoint read gains wal_records as its appended last column. compare_analysis description names the seven PostgreSQL baselined keys on both SKUs; the parity pin follows.
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 free
to 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.
What does this PR do?
compare_analysison a PostgreSQL target now sigma-bands the three v2 baselined metrics —PG_IO_READ_LATENCY_MS,PG_REPLICATION_LAGandPG_WAL_VOLUME_SHIFT— against the server's own hour-of-week bucket, and the write family has ONE definition of "WAL tracked" that both its facts apply. Two residues from the v2 exit check. PARTIAL for #3691 — do not close. Checklist line completed verbatim:compare_analysisbands the v2 baselined metrics absolutelyItem 1 — the W1 gap, repeated for the v2 baselines
#3713 closed W1 by mapping the four v1
pg_buckets inComparisonBanding.BaselinedMetricForand adding theBaselinedValueForunit-reconciliation seam. The v2 lanes then stored three more buckets (pg_io_read_latency, #3726/#3737;pg_replay_lag_bytes, #3727;pg_wal_bytes_per_sec, #3728) with detectors that judge against them — and nobody extended the seam. On the exit check's planted storePG_IO_READ_LATENCY_MS(1.55 → 25 ms),PG_REPLICATION_LAG(1 → 200 MB) andPG_WAL_VOLUME_SHIFT(1 → 9.7 MB/s) came backband_source: absolute,baseline_metric: nullin the same window their detectors called 25σ.Before (the exit check's shape, reconstructed for the live class's planted I/O series: the absolute arm's
relative_move/ladder_positionare the very figures the after-payload still carries, and with no mapped metric the row could only have taken that arm — not a separately executed pre-change binary):{ "key": "PG_IO_READ_LATENCY_MS", "baseline_value": 1.5, "comparison_value": 25, "value_delta": 23.5, "relative_move": 0.94, "ladder_position": 0.875, "status": "worse", "band_source": "absolute", "delta_sigma": null, "baseline_sigma": null, "baseline_median": null, "baseline_metric": null }(I/O happens to clear the absolute rule because its ladder moves; the lag and WAL facts on the exit-check store did not —
PG_WAL_VOLUME_SHIFThas base 0 by design, exactlyPG_TPS's trap.)After, the same store through the REAL
DarlingMcpTools.CompareAnalysis, read off the executed live class:{ "key": "PG_IO_READ_LATENCY_MS", "baseline_value": 1.499848, "comparison_value": 25, "value_delta": 23.500152, "relative_move": 0.94, "ladder_position": 0.875, "status": "worse", "band_source": "baseline", "delta_sigma": 25, "baseline_sigma": 0.0207, "baseline_median": 1.5017, "baseline_confidence": 0.85, "baseline_tier": "Full", "baseline_metric": "pg_io_read_latency", "beyond_anomaly_cutoff": true }The three arms, each verified against its collector's unit before mapping:
PG_IO_READ_LATENCY_MS(PgTargetFactCollector.Io.cs):Value= window read ms ÷ reads;pg_io_read_latency= the same quotient per quarter-hour sample. Same unit, the averaged-key case (per-sample sigma bounds the average's dispersion; the band is conservative) — banded onValue.BaselinedValueForwithholds a fact that makes no latency claim (latency_measured = 0: nopg_stat_ioon the major, ortrack_io_timingoff — bothunavailableshapes) and one whose quotient the scorer states but does not grade (insufficient_ops = 1); the scorer's own vocabulary, no new flag.PG_REPLICATION_LAG(.Replication.cs):Value= the window's peakreplay_bytes_behind(one fact, the worst standby);pg_replay_lag_bytes=MAX(replay_bytes_behind)per collection. Same bytes — banded onValue. No unavailable shape exists (a server with no replication emits nothing).PG_WAL_VOLUME_SHIFT(.Write.cs):Value= the window's MEAN bytes/s across rated collections; the bucket is per-collection bytes/s andPgTargetAnomalyDetector.Wal.csjudges the window's PEAK against it. So this is the second key (afterPG_CONNECTION_SATURATION) whoseValueis not the reading banded: the row bands on the fact'speak_wal_bytes_per_secmetadata via the compare_analysis sigma-bands the PostgreSQL baselined metrics, so a 6× TPS surge on a PostgreSQL target stops reading "stable" (#3691 W1/W2) #3713 seam — the reading whose verdictbeyond_anomaly_cutoffclaims to agree with — andvalue_deltastays the mean, stated inBandBySigma. Theunavailableshape (Aurora, pre-14, an all-zero series) carries no peak, so it is withheld by the metadata's absence and no second flag is consulted here; two unavailable sides readstableby the absolute rule with no sigma andbaseline_metricstill naming the bucket (pinned). Rejected: banding the mean (it would disagree with the detector on the same window) and invertingbeyond_anomaly_cutoff's meaning for one key.The
compare_analysisdescription enumerated the PostgreSQL keys ("transactions/sec, session count, deadlocks/hour, CPU as % of capacity"), so it now names all seven on both SKUs;PgTargetBetweenWavesV2Tests' parity pin follows deliberately and additionally pins that exactly sevenPgTargetFactKeysconstants map to apg_metric — a new key silently mapped, or a described one silently dropped, fails it.Item 2 — one definition of "WAL tracked"
Lane 15 (#3728) shipped two:
ReadCheckpointPressureAsyncdecided from NULL-ness alone (bool_or(wal_bytes IS NOT NULL)) and stampedwal_tracked 1, wal_bytes 0, wal_bytes_per_sec 0;ReadWalVolumeAsync, over the SAME table and window a moment later, also required a non-zero byte OR record sum and emittedunavailable / reason_wal_stats_not_reported. On a window whosewal_bytesis 0-not-NULL the two facts contradicted each other on one pass. That shape is a planted store's — the real collector types the WAL columns NULL wherepg_stat_walis not implemented (Aurora) or does not exist (below 14), so on the fleet it is unreachable — but a read that can contradict its sibling on any input is two definitions, andPgTargetAdvice.Write.csreads the pressure fact's flag to decide whether to state WAL figures at all.PgTargetFactCollector.WalIsTracked(anyNonNull, walBytes, walRecords)—anyNonNull && (walBytes > 0 || walRecords > 0)— is now the one predicate, documented once (mechanism, the exit-check evidence, why one, what it does not change), applied by both reads. The checkpoint read's SQL gainswal_recordsas its appended last column (ordinal 11, aftersample_count) so the ten ordinals lane 2 and lane 15 read did not move; the differencing is the WAL read's, verbatim. Untracked leaves the pressure fact's WAL figures ABSENT, not zero — the posture it had. Bytes moving with records at 0 (thePgTargetKnobsTestsfixture) stays tracked: either counter moving is the counter being populated.Blast radius
BaselinedValueForis its value (the_ => fact.Valuearm), the four SQL Server metric arms are untouched,DispersionMetricsForover a SQL Server set names nopg_metric —ComparisonBandingTests.ASqlServerFactSet_NeverReachesThePostgresArmsand the 18 SQL Server scenarios pass unchanged.ComparisonBanding; never asked for apg_metric because it has nopg_-sourced facts. Itscompare_analysisdescription changes by the same seven words as Darling's (parity).LookUpDispersionAsyncissues up to three more windowed bucket reads per compare (the same reads the anomaly pass already makes; not on the alert path). Payload shape unchanged. The write family's two facts now agree on trackedness on every input; on the fleet (all-NULL on Aurora) both said untracked before and say so now.What it does NOT do
Does not band
PG_IO_WRITE_LATENCY_MS(no write-latency bucket),PG_WAIT_PROFILE, or the buffer / checkpoint / vacuum / temp / config readings (no bucket). Does not give any key a two-sided reading (v3). Does not makeband_rules.baselineengine-aware (its sentence is shared; noted on #3713). Does not touchPgTargetBaselineProvider,MetricNames, any scorer, detector or advice file, orPgTargetKnobsTests(its(wal_bytes IS NOT NULL) AS wal_trackedpin still holds — the SQL keeps that column). No rung, no key, no knob.Every file, one line
PerformanceMonitor.Analysis/ComparisonBanding.csBaselinedMetricFor; two inBaselinedValueFor(I/O withheld shapes, WAL peak);PgWalPeakBytesPerSecKey; the class summary /Compare/BandBySigmadoc lines the change falsifiedDarling/…/PgTargetFactCollector.Write.csWalIsTracked;wal_recordsappended toPgTargetCheckpointSql; both reads call the predicate; docLite.Tests/ComparisonBandingTests.csDispersionMetricsFor); four collector-shaped buildersDarling/Darling.Tests/CompareAnalysisPgBandingLiveTests.csPG_IO_READ_LATENCY_MSrow asserted through the real tool; cleanup coverspg_io_statsDarling/Darling.Tests/PgTargetWriteTests.csWalIsTrackedtheory (six shapes); the checkpoint read's column pin; a gated e2e planting the 0-not-NULL fixture and asserting both facts untrackedDarling/…/Mcp/DarlingMcpTools.cs,Lite/Mcp/McpAnalysisTools.csDarling/Darling.Tests/PgTargetBetweenWavesV2Tests.csWhich component(s) does this affect?
PerformanceMonitor.Analysis; description parity)How was this tested?
EXECUTED here — two net10.0 harnesses compiling the real test files against this tree (first execution of everything by CI on Windows):
AssemblyName=Lite.Tests,ComparisonBandingTests.csagainstPerformanceMonitor.Analysis): 24/24 — the 23 existing (incl. the five compare_analysis sigma-bands the PostgreSQL baselined metrics, so a 6× TPS surge on a PostgreSQL target stops reading "stable" (#3691 W1/W2) #3713 PostgreSQL tests and the SQL Server routing pin, unchanged) +TheV2PostgresBaselinedKeys_IoLatency_ReplayLag_AndWalVolume_BandBySigma_AndTheirUnavailableShapesDoNot: I/O 1.5 → 25 ms against median 1.5 / σ 0.1 →worse, 25σ display cap,beyond_anomaly_cutoff; inside one sigma stable;latency_measured 0andinsufficient_ops 1withheld → absolute, bucket named; lag 1 → 200 MB against 1 MB / σ 100 kB → worse; WAL peak 1.2 → 12 MB/s banded withvalue_delta= the MEAN's 8.7 MB/s; a one-sigma peak is stable however the mean wobbled; Auroraunavailableboth sides →stable/absolute/ no sigma /pg_wal_bytes_per_secnamed;DispersionMetricsFornames exactly the seven.AssemblyName=Darling.Tests, 16 PgTarget/census classes) against a throwawaytimescale/timescaledb:2.28.1-pg18on Docker contextdesktop-linux, migrated by the fixture, torn down after: 288/289 with all 7 gated e2es executed (the one red is the harness csproj's own presence trippingDocCommentHygieneTests.TheDerivedProjectListCoversEveryProjectInTheTree— the artifact PostgreSQL targets enter the analysis pipeline: the pass routes by registry engine_kind inside the service, a pg_database_stats coverage witness replaces the tombstone, and every shared switch gains its one pg_ arm so the content lanes can build in parallel (#3542 v1 plumbing) #3665/v2 plumbing for the PostgreSQL-target engine: the I/O, replication and bloat families exist as stubs, and the wait-profile anomaly folds onto its wait and can page (partial #3691) #3715/The write family tells Aurora the truth: checkpoint pressure and max_wal_size are not applicable where storage owns checkpointing, and WAL volume is graded against its own baseline where the engine reports it (partial #3691) #3728 recorded). That includes:CompareAnalysisPgBandingLiveTestswith the I/O series (the After payload above is read off it);PgTargetWriteTests29/29 —WalIsTrackedsix shapes, the appended-column pin, the newAZeroNotNullWalSeries_ReadsUntracked_OnBothWriteFacts_ThroughTheOnePredicate(240 timed checkpoints,wal_tracked 0, nowal_bytes*on pressure; shiftunavailable/reason_wal_stats_not_reported, no peak) and lane 15's two e2es unchanged;PgTargetKnobsTests' churn e2e (bytes moving, records 0 → stillwal_tracked 1);PgTargetBetweenWavesV2Tests(the re-pinned description); the censusesPgTargetFactCollectorTests(AllSql closure, FROM/JOIN whitelist, dialect),PgTargetThresholdLineageTests,PgTargetSharedSwitchRoutingTests,PgTargetMcpSurfaceTests,StoreSqlClockDisciplineTests,LiveCleanupConversionRatchetTests,LivePostgresCollectionHygieneTests,RepoFileAdoptionTests,AuroraOnlySqlIsGatedTests,DocCommentHygieneTests(all but the project-list pin).Builds, zero warnings of ours:
PerformanceMonitor.Analysis0/0;PerformanceMonitor.Darling.Analysis0/0;PerformanceMonitor.Darling.Service0/0;Lite/PerformanceMonitorLite(-p:EnableWindowsTargeting=true) 0/0;Darling/Darling.Tests0/0;deprecated/Dashboard.Tests0/0;Lite.Tests1 warning = dev's pre-existingxUnit2000atLogTailOverlapThresholdPinTests.cs:95.No production store or fleet server was read.
Checklist
dotnet build -c Debug)Partial for #3691 (step 19). CHANGELOG deliberately untouched — the coordinator splices this wave's entries. Not armed (review-dark window).