Change Vulnerabilities Statistics services to set traversal_ids, archived
Why are we doing this work
Update UpdateService
and AdjusmentService
of Vulnerabilities::Statistics
so that they set the new traversal_ids
and archived
columns
introduced in Add traversal_ids column to vulnerability_stati... (#512592 - closed).
This is similar to Set archived, traversal_ids upon vulnerability ... (#513228 - closed).
Relevant links
Non-functional requirements
-
Documentation: -
Feature flag: -
Performance: -
Testing: Update specs of the services being changed.
Implementation plan
- Update
ee/app/services/vulnerabilities/statistics/adjustment_service.rb
- Update
ee/app/services/vulnerabilities/statistics/update_service.rb
The changes are similar to the ones we did in ee/app/services/security/ingestion/tasks/ingest_vulnerability_statistics.rb
to solve
Set archived, traversal_ids upon vulnerability ... (#513228 - closed).
Verification steps
The number of records where traversal_ids
is not set should remain stable on production.
SQL queries to check this:
select count(*) from vulnerability_statistics
where traversal_ids = '{}'::bigint[]
and latest_pipeline_id is not null;
select count(*) from vulnerability_statistics
where traversal_ids = '{}'::bigint[]
and latest_pipeline_id is null;
Queries to count records on postgres.ai:
explain select 1 from vulnerability_statistics
where traversal_ids = '{}'::bigint[]
and latest_pipeline_id is null;
explain select 1 from vulnerability_statistics
where traversal_ids = '{}'::bigint[]
and latest_pipeline_id is not null;
See #513030 (comment 2335802405) for baseline as of 7 February 2025 at 07:36:03 CET
on postgres.ai.
/cc @ghavenga