Skip to content

Conversation

@joyvuu-dave
Copy link
Contributor

@joyvuu-dave joyvuu-dave commented Nov 4, 2025

This PR partially addresses #4182.

It solves the issue of consumers of Usage Records not having a way of determining the current state of running apps and services.

With this change, usage event records related to running Apps and Services are kept from being pruned during the normal cleanup job.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 4, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@joyvuu-dave joyvuu-dave changed the title Keep running records Keep Usage Event records of running apps and services Nov 4, 2025
@joyvuu-dave joyvuu-dave force-pushed the keep_running_records branch 3 times, most recently from c3e6033 to 4d6c72b Compare November 12, 2025 02:35
@joyvuu-dave joyvuu-dave force-pushed the keep_running_records branch 2 times, most recently from 05b4600 to 801091c Compare November 13, 2025 16:14
- Change initialize signature to use keyword argument: cutoff_age_in_days:
- Rename internal variable @days_ago to @cutoff_age_in_days for consistency
- Add keep_running_records parameter to OldRecordCleanup
- Implement exclude_running_records method to retain START/CREATED records
  without corresponding STOP/DELETED records
- Enable keep_running_records for AppUsageEvent and ServiceUsageEvent cleanup
- Add indexes for increasing performance on state queries
- Add comprehensive unit tests

The exclude_running_records method identifies
START records that have matching STOP records
while keeping START records without matching STOPs.

This prevents premature deletion of usage event records for long-running
apps and services, ensuring consumers can always determine the true start
time of active resources.
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