Keep Usage Event records of running & un-processed Apps and Services #4374
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.
Addresses #4182
Commit
Allows users to turn on or off keep_unprocessed_records feature
Leave it off by default
Commit
Seed Usage Event records
Useful for integration testing. May only be needed while validating Usage Consumer feature.
Commit
Fix a typo
Commit
Provide index, show, and destroy endpoints for usage consumers
Allows for usage consumers to de-register themselves with the cloud controller. Index and show methods allow consumers to make informed decisions before initiating a purge of usage events.
Usage event endpoint re-ordered to align with convention of other resources.
Commit
Set threshold for keeping un-processed records
Only keep un-processed records if usage event table size is below threshold. This is a safeguard to ensure row count does not grow unbounded in the event of a zombie consumer.
Commit
Maintain un-processed usage event records
Allow consumer_guid to be passed into request for AppUsageEvent and ServiceUsageEvent records. This establishes a consumer of these events. Un-processed consumer records will be maintained by cloud controller. Registered consumers are automatically deleted if associated event is removed.
Commit
Keep usage event records of running apps and services
AppUsageEvent and ServiceUsageEvent records can be used to track the lifecycle of apps and services in a foundation. However, if the start event is pruned before end event, the foundation no longer maintains an accurate state of its running apps and services. By holding on to the start events, consumers of these records are able to get an accurate picture of the current state whenever they choose to begin consuming usage event records.
Commit
Make cutoff_age_in_days a named parameter
Better aligns with style used throughout codebase. Done in anticipation of adding more parameters to the
initialize
method.I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement <-- in progress
I have made this pull request to the
main
branchI have run all the unit tests using
bundle exec rake
I have run CF Acceptance Tests