fix(consolidation): emit consolidated slug only when aggregated profiles change#341
Open
shanyl9 wants to merge 1 commit into
Open
fix(consolidation): emit consolidated slug only when aggregated profiles change#341shanyl9 wants to merge 1 commit into
shanyl9 wants to merge 1 commit into
Conversation
…les change consolidateKeyTimeSeries emitted a consolidated slug (which drives a downstream AP/NN onFinish and ultimately a container_statuses upsert) on every run for every k8s workload, even when the run produced no new data. For idle/already-consolidated workloads this re-emits the same onFinish every tick, flooding synchronizer-finished-v1 and feeding the container_statuses deadlock storm downstream (the AP/NN aren't rewritten on a no-new-data run, so the emission is pure churn). Thread the newData signal out of updateProfile/processTimeSeriesInTransaction as aggregatedUpdated and gate sendConsolidatedSlugToChannel on it, so a slug is emitted only when the aggregated AP/NN were actually rewritten this run. This matches the existing newData gate on updateAggregatedProfiles. Adds a unit test asserting no emission on a no-new-data consolidation, and a feature doc describing the gating. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
|
Summary:
|
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.
Problem
ContainerProfileProcessor.consolidateKeyTimeSeriesemitted a consolidated slug on every consolidation run for every k8s workload — even when the run produced no new data. Each slug drives a downstream AP/NNonFinishmessage (event-ingester-service) and ultimately acontainer_statusesupsert.For idle / already-consolidated workloads this re-emits the same
onFinishon every 30s tick. In prod (prod-ap-southeast-2) this flooded thesynchronizer-finished-v1topic and fed acontainer_statusesdeadlock storm downstream: ~97% of one customer'scontainer_statusesrows were rewritten hourly despite averaging ~26 days old.The aggregated AP/NN are only rewritten when there is new data (
updateAggregatedProfilesis already gated onnewData), so emitting on a no-new-data run is pure churn.Change
updateProfileandprocessTimeSeriesInTransactionnow returnaggregatedUpdated bool, mirroring the existingnewDatagate onupdateAggregatedProfiles.consolidateKeyTimeSeriesemits the slug only whenHostType == Kubernetes && aggregatedUpdated.has_data=falseseries with no new entries) now emit nothing instead of re-emitting every tick.Tests
TestConsolidateKeyTimeSeries_NoEmitWhenNoNewData(written test-first: fails on the old code, which emitted with zero new data; passes after the gate).pkg/registry/filesuite passes, including the sqlite-backedTestConsolidateData.Docs
docs/features/container-profile-consolidation-emit.mddescribing the gating.Notes
This is the source-side half of a broader fix. Downstream, the
container_statusesupsert is separately hardened with deadlock retry + deterministic lock ordering inpostgres-connector.🤖 Generated with Claude Code