Skip to content

Fix container-event event_instance_id mismatch between stats_aggregator_fact and event_instance_fact - #83

Merged
tombonfert merged 3 commits into
mainfrom
fix/container_event_instance_id_stats_fact
Aug 20, 2026
Merged

Fix container-event event_instance_id mismatch between stats_aggregator_fact and event_instance_fact#83
tombonfert merged 3 commits into
mainfrom
fix/container_event_instance_id_stats_fact

Conversation

@tombonfert

Copy link
Copy Markdown
Collaborator

Problem

For a CONTAINER_EVENT, stats_aggregator_fact produced a different event_instance_id
than event_instance_fact for the same event.

Cause

StatsAggregator._add_event_instance_id_column called generate_event_instance_id_column
without an event type, so container-event rows used the timestamp-based hash
(crc32(container_id::event_name::start_ts::end_ts)) instead of crc32(container_id).
Since timestamps vary per aggregation, the id fragmented.

Fix

Apply the ContainerEvent case per row (keyed on stats_name, like the sibling
mappers), routing through generate_event_instance_id_column(event_type=ContainerEvent)
so the id matches event_instance_fact by construction.

Tests

  • New regression test for container-event + stats id consistency (fails without the fix).
  • Tightened test_persist_statistics_with_events, whose old assertion always passed.
  • Full stats/container-event sweep green; lint clean.

Test Plan

  • Unit tests added/updated
  • Manual testing completed
  • Documentation updated (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No new linter warnings introduced

…nt_instance_fact

- Use crc32(container_id) for ContainerEvent stats rows, while other event types keep the timestamp-based hash.
- Strengthen integration test to assert every stats fact event_instance_id exists in event_instance_fact.
- Add unit test verifying container-event id consistency and basic-event id divergence.
@tombonfert
tombonfert requested a review from a team as a code owner August 20, 2026 07:40
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.01%. Comparing base (a042e3c) to head (0dd027c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   88.99%   89.01%   +0.01%     
==========================================
  Files          61       61              
  Lines        5199     5207       +8     
  Branches      627      628       +1     
==========================================
+ Hits         4627     4635       +8     
  Misses        461      461              
  Partials      111      111              
Flag Coverage Δ
query_engine 84.77% <ø> (ø)
reporting 94.24% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...e_reporting/aggregations/point_value_aggregator.py 97.64% <ø> (ø)
...impulse_reporting/aggregations/stats_aggregator.py 94.25% <100.00%> (+0.22%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…gator

- Aligns PointValueAggregator with the StatsAggregator fix for container-event event_instance_id generation.
@tombonfert
tombonfert merged commit b7f9480 into main Aug 20, 2026
6 checks passed
@tombonfert
tombonfert deleted the fix/container_event_instance_id_stats_fact branch August 20, 2026 08:54
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.

1 participant