Skip to content

Commit 1f9920d

Browse files
feat(crons): Add environment support to the HTTP examples (#6634)
1 parent 2b37e39 commit 1f9920d

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

src/platforms/common/crons/index.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,42 @@ If you expect your scheduled jobs to overlap, read about [Overlapping Jobs](#ove
109109

110110
</Note>
111111

112+
### Specifying monitor environments (Optional)
113+
114+
When sending check-ins to your monitor you may specify the `environment` of the
115+
check-in. This allows you to monitor a single schedule across multiple
116+
environments.
117+
118+
If you don't specify an environment with your check-ins the default is `production`.
119+
120+
<Alert level="info">
121+
122+
Monitor environments are still early in development. Currently, after a check-in
123+
occurs for a specified environment you must continue sending check-ins on
124+
schedule or the monitor environment will be marked as missed.
125+
126+
In the future it will be possible to delete environments for a specified monitor.
127+
128+
</Alert>
129+
130+
```bash {tabTitle: cURL}
131+
# 🟡 Notify Sentry your job is running in the dev environment:
132+
curl -X POST \
133+
'https://sentry.io/api/0/organizations/___ORG_SLUG___/monitors/<monitor_slug>/checkins/' \
134+
--header 'Authorization: DSN ___PUBLIC_DSN___' \
135+
--header 'Content-Type: application/json' \
136+
--data-raw '{"status": "in_progress", "environment": "dev"}'
137+
138+
# Execute your scheduled task here...
139+
140+
# 🟢 Notify Sentry your dev environment job has completed successfully:
141+
curl -X PUT \
142+
'https://sentry.io/api/0/organizations/___ORG_SLUG___/monitors/<monitor_slug>/checkins/latest/' \
143+
--header 'Authorization: DSN ___PUBLIC_DSN___' \
144+
--header 'Content-Type: application/json' \
145+
--data-raw '{"status": "ok", "environment": "dev"}'
146+
```
147+
112148
### Creating or Updating a Monitor Through a Check-In (Optional)
113149

114150
Sentry enables the automatic creation or update of a monitor (upsert) through the check-in payload. This can be useful if you have many scheduled tasks or need to create them dynamically.

src/platforms/common/crons/troubleshooting-crons.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ You may not have <PlatformLink to="/crons/#alerts">set up alerts for your monito
2020

2121
</PlatformSection>
2222

23-
### How Can I Specify an Environment (Such as Production or Development), for a Monitor?
24-
Crons doesn't currently support multiple environments.
25-
2623
### What Is the Crons Data Retention Policy for Check-ins and Attachments?
2724
Our current data retention policy is 90 days.
2825

0 commit comments

Comments
 (0)