Create consistent AppUsageEvent records#1601
Conversation
|
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/172592163 The labels on this github issue will be updated when the story is started. |
|
Thanks for the PR @joyvuu-dave. We will take a look and merge once checks complete. |
|
ah you're getting robocoped @joyvuu-dave Looks like its just a trailing whitespace but it will fail the units. |
| org_guid: "#{Organization.table_name}__guid".to_sym, | ||
| created_at: Sequel.datetime_class.now, | ||
| parent_app_name: :parent_app__name, | ||
| parent_app_guid: "#{ProcessModel.table_name}__guid".to_sym, |
There was a problem hiding this comment.
should this be #{AppModel.table_name}__guid?
There was a problem hiding this comment.
I don't think the reference to AppModel resolves (at least it didn't when I tried). However, it looks like we can just reference parent_app__guid directly. I updated the PR and also added a test to confirm parent_app_guid and app_guid end up being equal.
There was a problem hiding this comment.
One last change -- I updated the test to show that parent_app_name and parent_app_guid are set to the values of the App name and guid.
7693f47 to
3e44a21
Compare
When a user makes a POST to /v2/app_usage_events/destructively_purge_all_and_reseed_started_apps, all existing AppUsageEvent records are purged from the database and new AppUsageEvent records are created for any running processes. This action is taken by clients who may have missed previous events that have now been pruned from the database as part of routeine mainteance and now need a new starting spot for tracking usage. All AppUsageEvent records created outside of a purge and reseed action will have their parent_app_name and parent_app_guid fields set. This change makes AppUsageEvent recoreds created as a result of a purge consistent with all other records in that respect. Not having the parent_app_name and parent_app_guid fields set was causing 3rd party usage monitoring systems that expected their presence to break. Authored-by: Dave Riddle <driddle@pivotal.io>
When a user makes a POST to
/v2/app_usage_events/destructively_purge_all_and_reseed_started_apps,
all existing AppUsageEvent records are purged from the database and new
AppUsageEvent records are created for any running processes. This action
is taken by clients who may have missed previous events that have now
been pruned from the database as part of routeine mainteance and now
need a new starting spot for tracking usage.
All AppUsageEvent records created outside of a purge and reseed action
will have their parent_app_name and parent_app_guid fields set. This
change makes AppUsageEvent recoreds created as a result of a purge
consistent with all other records in that respect.
Not having the parent_app_name and parent_app_guid fields set was
causing 3rd party usage monitoring systems that expected their presence
to break.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
masterbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests