-
Notifications
You must be signed in to change notification settings - Fork 535
KeyError('sentry-monitor-start-timestamp-s') #3277
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
Comments
your fix is ok, but I think there's something else going wrong because ideally the headers should be set when queuing the task here |
@Mohsen-Khodabakhshi, by any chance do you see any other errors in your logs before the |
@szokeasaurusrex It's all logs between receive task util success in my celery worker and the error happens in between:
And I called sentry_sdk in my celery main file like this: from celery import Celery
from celery.schedules import crontab
from sentry_sdk.scrubber import EventScrubber
from sentry_sdk.integrations.celery import CeleryIntegration
from core.settings import settings
import sentry_sdk
from domains.common.services.sentry import SENTRY_DENYLIST
sentry_sdk.init(
dsn=settings.SENTRY_URL,
enable_tracing=True,
traces_sample_rate=1.0,
event_scrubber=EventScrubber(denylist=SENTRY_DENYLIST),
integrations=[CeleryIntegration(
monitor_beat_tasks=True,
)]
)
celery = Celery(
__name__,
include=["domains.concierge_sale.tasks"],
)
celery.conf.result_backend = settings.TRADE_CELERY_RESULT_BACKEND_URL
celery.conf.broker_url = settings.TRADE_CELERY_BROKER_URL
celery.conf.beat_schedule = {
"shop-analytics-data-every-day": {
"task": "send_concierge_sale_to_assistant_offer_task",
"schedule": crontab(minute="*/1"),
},
}
celery.conf.imports = ["domains.concierge_sale.tasks"]
celery.conf.result_backend_transport_options = {
"global_keyprefix": settings.TRADE_CELERY_TASK_DEFAULT_QUEUE,
"visibility_timeout": 172800,
}
celery.conf.celery_task_default_queue = settings.TRADE_CELERY_TASK_DEFAULT_QUEUE |
@Mohsen-Khodabakhshi the error message we are looking for would be in the logs for the process creating the tasks (probably the Beat scheduler logs in your case), not in the Celery worker logs. Could you check the Beat scheduler logs and see if you can find any error message containing the following?
|
@szokeasaurusrex There is no error/exception in our Celery beat pod: |
@Mohsen-Khodabakhshi thanks for the clarification |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.8.0
Steps to Reproduce
I had a task at the company to track Celery beat tasks in Sentry. This task has been completed, and everything is working correctly. However, with each execution of the task, an unusual exception is displayed in Sentry. This happens once every minute.
Since I set the monitor_beat_tasks to True, this event has been occurring.
This exception is handled, but It is not interesting that it is constantly displayed on sentry.
Interestingly, this does not happen in the local environment(in my laptop)! and just we have this problem on production.
My local system:
Ubuntu 22.04
Python 3.10.12
Celery 5.3.6
sentry_sdk 2.8.0
In production we using Docker and Kubernetes, we are using Python:3.10 image and packages versions are same as my local!
Expected Result
Don't show this exception on sentry.
My task is working well and this error has made our sentry busy.
Actual Result
Logs of celery worker in production:
The text was updated successfully, but these errors were encountered: