Title: Automatically create monitors when using Redbeat · Issue #2616 · getsentry/sentry-python · GitHub
Open Graph Title: Automatically create monitors when using Redbeat · Issue #2616 · getsentry/sentry-python
X Title: Automatically create monitors when using Redbeat · Issue #2616 · getsentry/sentry-python
Description: Environment SaaS (https://sentry.io/) Steps to Reproduce We're using Python with Celery and Redbeat and following the docs for setup. Using either the autodiscover or manual @monitor instrumentation outlined in the docs, we are not havin...
Open Graph Description: Environment SaaS (https://sentry.io/) Steps to Reproduce We're using Python with Celery and Redbeat and following the docs for setup. Using either the autodiscover or manual @monitor instrumentatio...
X Description: Environment SaaS (https://sentry.io/) Steps to Reproduce We're using Python with Celery and Redbeat and following the docs for setup. Using either the autodiscover or manual @monitor instrument...
Opengraph URL: https://github.com/getsentry/sentry-python/issues/2616
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Automatically create monitors when using Redbeat","articleBody":"### Environment\r\n\r\nSaaS (https://sentry.io/)\r\n\r\n### Steps to Reproduce\r\n\r\nWe're using Python with [Celery] and [Redbeat] and following the [docs] for setup. Using _either_ the autodiscover or manual `@monitor` instrumentation outlined in the docs, we are not having monitors in our Sentry UI automatically created. But manually creating them confirms that the data does come into Sentry—as soon as they're created we can see data for them in the UI, but only from that point forward.\r\n\r\nI've been talking to Sentry support about this and was asked to create an Issue. Unfortunately our repo is private but our setup is pretty straightforward. Here's the gist of what we've got:\r\n\r\n`requirements.txt`:\r\n\r\n```\r\ncelery==5.2.6\r\ncelery-redbeat==2.0.0\r\n```\r\n\r\n`worker.py`\r\n\r\n```py\r\nfrom celery import Celery\r\nfrom celery.signals import celeryd_init\r\nfrom celery.schedules import crontab\r\nimport sentry_sdk\r\nfrom sentry_sdk.crons.decorator import monitor\r\nfrom sentry_sdk.integrations.celery import CeleryIntegration\r\n\r\nfrom myco import _my_celery_task, get_env_var, LockInUse, get_redis_url\r\n\r\napp = Celery(__name__, broker=get_redis_url(database='celery'))\r\n\r\n@celeryd_init.connect\r\ndef init_sentry(**_kwargs):\r\n env = get_env_var('APP_ENV', False)\r\n if not env:\r\n print('APP_ENV not set, defaulting to development')\r\n env = 'development'\r\n if env not in ['development', 'test']:\r\n sentry_sdk.init(\r\n dsn=\"\u003cDSN@ingest.sentry.io>\", # obviously this is redacted\r\n\r\n environment=env,\r\n release=get_env_var('SENTRY_RELEASE_VERSION', False) or 'unknown',\r\n\r\n ignore_errors=[LockInUse],\r\n\r\n integrations=[CeleryIntegration()],\r\n\r\n # Set traces_sample_rate to 1.0 to capture 100%\r\n # of transactions for performance monitoring.\r\n # We recommend adjusting this value in production,\r\n traces_sample_rate=0.005,\r\n )\r\n\r\n# ...\r\n\r\n\r\n@app.task\r\n@monitor(monitor_slug='my_celery_task')\r\ndef my_celery_task():\r\n return _my_celery_task()\r\n\r\n# ...\r\n\r\napp.conf.redbeat_redis_url = get_redis_url(database='celery')\r\napp.conf.beat_scheduler = 'redbeat.RedBeatScheduler'\r\napp.conf.beat_schedule = {\r\n 'my-celery-task': {\r\n 'task': 'worker.my_celery_task',\r\n 'schedule': crontab(minute='0', hour='0', day_of_week='1'),\r\n },\r\n # ...\r\n}\r\n```\r\n\r\n[celery]: https://docs.celeryq.dev/en/stable/\r\n[redbeat]: https://pypi.org/project/celery-redbeat/\r\n[docs]: https://docs.sentry.io/platforms/python/crons/\r\n\r\n### Expected Result\r\n\r\nCron job monitors are automatically created in Sentry on deploy, or at least when they execute\r\n\r\n### Actual Result\r\n\r\nNo monitors are created\r\n\r\n### Product Area\r\n\r\nCrons\r\n\r\n### Link\r\n\r\n_No response_\r\n\r\n### DSN\r\n\r\n_No response_\r\n\r\n### Version\r\n\r\n_No response_","author":{"url":"https://github.com/bensaufley","@type":"Person","name":"bensaufley"},"datePublished":"2023-12-20T19:49:37Z","url":"https://github.com/getsentry/sentry-python/issues/2616"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:423583ab-03d2-c8f2-67cb-2201c6d22949 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBD6:D9951:308328:43A4D5:6B008B09 |
| html-safe-nonce | a14e9593f9e092fea02269b77accc929f315fef82e779d74d4087a5919eb0e5c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkQ2OkQ5OTUxOjMwODMyODo0M0E0RDU6NkIwMDhCMDkiLCJ2aXNpdG9yX2lkIjoiNjM2NzkzMjI3MTA3MjE1MjMyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1a985b7dddb9f0272b6613083d9a54f3337d4656fa72841e2d42220dfef345f4 |
| hovercard-subject-tag | issue:2063969763 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/2616/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7fccd30619c2ca8eb2e4929b00dbded76331651d210707e103bfc5c95fd59cb3/getsentry/sentry-python/issues/2616 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7fccd30619c2ca8eb2e4929b00dbded76331651d210707e103bfc5c95fd59cb3/getsentry/sentry-python/issues/2616 |
| og:image:alt | Environment SaaS (https://sentry.io/) Steps to Reproduce We're using Python with Celery and Redbeat and following the docs for setup. Using either the autodiscover or manual @monitor instrumentatio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bensaufley |
| hostname | github.com |
| expected-hostname | github.com |
| None | c710a5cb5c47be60abfe6e8410436d409906979dbed614ef09f29c60f5535b08 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | be616a2a6ec1c609d6e002896dff5352d5c5f28b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width