sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Crons Celery: automatically clean up tasks that are no longer in use

Open gaprl opened this issue 1 year ago • 4 comments

Our Celery integration makes it easy to set up multiple monitors, sometimes more than 100 at once. However, if changes are made to these tasks that apply to all monitors simultaneously—for example, changing an environment name from prod to us — all monitors will start emitting "missed" errors.

Ideally, our Celery integration would track these changes and automatically clean up any old environments or monitors for tasks that no longer exist.

gaprl avatar Jun 03 '24 17:06 gaprl

Ideally, our Celery integration would track these changes and automatically clean up any old environments or monitors for tasks that no longer exist.

This is probably not going to happen since the SDKs do not maintain state.

evanpurkhiser avatar Jun 03 '24 18:06 evanpurkhiser

This is probably not going to happen since the SDKs do not maintain state.

I believe @evanpurkhiser is correct here: the SDK would need to have a list of the currently running cron jobs that are being monitored to implement this change, but we don't have such a list as far as I know. My understanding is that we emit checkins (including monitor upserts) as cron jobs are run, without storing any information about them in the SDK

szokeasaurusrex avatar Jun 03 '24 18:06 szokeasaurusrex

This is probably not going to happen since the SDKs do not maintain state.

I believe @evanpurkhiser is correct here: the SDK would need to have a list of the currently running cron jobs that are being monitored to implement this change, but we don't have such a list as far as I know. My understanding is that we emit checkins (including monitor upserts) as cron jobs are run, without storing any information about them in the SDK

Right, I realize this is tricky. Any ideas how we can make this easier? We've had this scenario come up a couple of times, not only from us internally, but from customers as well. Is a UI-based bulk management solution the best way forward?

gaprl avatar Jun 04 '24 18:06 gaprl

Yes, a solution in the UI is the only way. The SDK does now know about config changes and I also think we should not implement something like this.

antonpirker avatar Jun 06 '24 13:06 antonpirker

@gaprl @antonpirker gonna close this issue for now, since as @antonpirker mentioned in his previous comment, there is not really any way we can do this in the SDK

szokeasaurusrex avatar Sep 06 '24 08:09 szokeasaurusrex