Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/v2/*/destructively_purge_all_and_reseed_started_apps - support an event ID to finish on #327

Closed
drnic opened this issue Jan 23, 2015 · 4 comments

Comments

@drnic
Copy link
Contributor

drnic commented Jan 23, 2015

I think there is a chance that after you've downloaded /v2/app_usage_events and /v2/service_usage_events, but before you run .../destructively_purge_all_and_reseed_started_apps there will be new events. I think this could be mitigated by passing in an argument like "?last_event_id="

All events up-to-and-including this last_event_id would be deleted but not anything newer.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/86790332.

@drnic
Copy link
Contributor Author

drnic commented Jan 23, 2015

@crhino
Copy link
Contributor

crhino commented Jan 24, 2015

@drnic We have discussed this with people who had some context on this endpoint, and the verdict is that this endpoint should only be called once, if at all. The use for this endpoint was basically to initiate a new "epoch" to start billing, it is not intended to be a weekly/monthly API call.

We would recommend that you use the /v2/app_usage_events and filter with the after_guid parameter in order to get events after a certain time. As noted on the api docs, events close to the current time should not be processed since other events might still be in transaction. The idea would be to periodically grab the events starting after a specific event guid until sometime before the current time, saving the last event guid that you process. You would then be able to periodically grab a time slice of events and use that for billing.

To periodically clean the events table, the cloud_controller_clock has a periodic job that will clean up events older than a specified date. This can be configured with the app_usage_events.cutoff_age_in_days property.

@drnic
Copy link
Contributor Author

drnic commented Jan 24, 2015

@crhino thanks mate! I've referenced your comment in the blog now.

@drnic drnic closed this as completed Jan 24, 2015
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

No branches or pull requests

3 participants