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

Monitor upsert support docs #8500

Merged
merged 8 commits into from
Nov 27, 2023
Merged

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Nov 15, 2023

Pre-merge checklist

If you work at Sentry, you're able to merge your own PR without review, but please don't unless there's a good reason.

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs
  • PR was reviewed and approved by a member of the Sentry docs team

Description of changes

This PR adds documentation for the new monitor upserts feature in the Sentry CLI, which allows users to create a cron monitor directly from the command line, without having to set it up in the Sentry web UI first.

Closes #8482

Copy link

vercel bot commented Nov 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2023 6:47pm


- `--check-in-margin`: The allowed margin of minutes after the expected check-in time that the monitor will not be considered missed for.
- `--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
- `--timezone` _(beta, use cautiously!)_: A tz database string (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone. Please be **absolutely sure that you provide a valid tz database string** when using this argument; as of writing, the CLI lacks the capability to validate this string, and so **the monitor creation will silently fail when the string is invalid!** For now, we recommend verifying that the cron monitor was created successfully in Sentry when using this argument.
Copy link
Member Author

@szokeasaurusrex szokeasaurusrex Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this --timezone option can cause the entire monitor upsert to silently fail if an invalid value is provided, I have labelled it as a beta feature for now. Is this appropriate?

We would need to make sure we remove the "beta" notice and the warning about the CLI not validating the string once we implement getsentry/relay#2718.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the beta note makes sense

Copy link
Contributor

@vivianyentran vivianyentran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments, but overall looks good! Thanks for adding to the docs!

src/docs/product/crons/getting-started/cli.mdx Outdated Show resolved Hide resolved
@@ -59,6 +59,32 @@ sentry-cli monitors run my-monitor-slug -- python path/to/file.py
sentry-cli monitors run my-monitor-slug -- node path/to/file.js
```

### Configuring Your Monitor via the CLI

You can also use the Sentry CLI to configure your cron monitor when you run your job. This way, you can avoid having to first set up the monitor through the Sentry web interface.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line feels weird in the middle of the page since it's general to the CLI and not specific to this section. I think you can either delete it or move it up to right before the "Requirements" section.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why you think this line is out of place here? I think it is necessary to include this line here to introduce the purpose of this feature; that is, that you can configure your monitor via the CLI instead of configuring via the web interface. The line also indicates that using this feature is optional, since monitors can also be created and configured in the Sentry web interface.

However, I agree that we should probably mention the possibility of setting up the monitor via the CLI itself in the "Requirements" section, so I will add a mention there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I thought it was implied from where the page lives (Crons -> Set Up -> CLI) that you were using the CLI to create / set up a new monitor, so it felt like something that should go at the top of the page. But now I see that the original feature was just for checking in on an existing monitor.

I think to make this clearer, you could keep this line here, but rename the section header to "Create or Update Your Monitor" similar to the section for HTTP.

- `--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
- `--timezone` _(beta, use cautiously!)_: A tz database string (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone. Please be **absolutely sure that you provide a valid tz database string** when using this argument; as of writing, the CLI lacks the capability to validate this string, and so **the monitor creation will silently fail when the string is invalid!** For now, we recommend verifying that the cron monitor was created successfully in Sentry when using this argument.

Below are some usage examples:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like how you have two examples here


- `--check-in-margin`: The allowed margin of minutes after the expected check-in time that the monitor will not be considered missed for.
- `--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
- `--timezone` _(beta, use cautiously!)_: A tz database string (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone. Please be **absolutely sure that you provide a valid tz database string** when using this argument; as of writing, the CLI lacks the capability to validate this string, and so **the monitor creation will silently fail when the string is invalid!** For now, we recommend verifying that the cron monitor was created successfully in Sentry when using this argument.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the beta note makes sense

Co-authored-by: vivianyentran <[email protected]>

- `--check-in-margin`: The allowed margin of minutes after the expected check-in time that the monitor will not be considered missed for.
- `--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
- `--timezone` _(beta, use cautiously!)_: A [tz database identifier string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone. Please be **absolutely sure that you provide a valid tz database string** when using this argument; as of writing, the CLI lacks the capability to validate this string, and so **the monitor creation will silently fail when the string is invalid!** For now, we recommend verifying that the cron monitor was created successfully in Sentry when using this argument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this labeled as Beta?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to call folks' attention to the fact that using this argument can cause the upsert to fail silently; however, it is probably sufficient to just have the "use cautiously" label. The "beta" label is redundant, since all features described on this page are beta features, according to the note at the top of the page


- `--check-in-margin`: The allowed margin of minutes after the expected check-in time that the monitor will not be considered missed for.
- `--max-runtime`: The allowed duration in minutes that the monitor may be in progress for before being considered failed due to timeout.
- `--timezone` _(beta, use cautiously!)_: A [tz database identifier string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) (e.g. "Europe/Vienna") representing the monitor's execution schedule's timezone. Please be **absolutely sure that you provide a valid tz database string** when using this argument; as of writing, the CLI lacks the capability to validate this string, and so **the monitor creation will silently fail when the string is invalid!** For now, we recommend verifying that the cron monitor was created successfully in Sentry when using this argument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add this timezone bit as a note instead of this long string at the end of the list item?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, a note was one of the options I also considered. Might be cleaner here

@szokeasaurusrex
Copy link
Member Author

@evanpurkhiser I made some changes to address the concerns you brought up, does it look good now?

@szokeasaurusrex szokeasaurusrex removed the request for review from loewenheim November 22, 2023 18:38
@szokeasaurusrex szokeasaurusrex merged commit eb5c3bd into master Nov 27, 2023
8 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/cli-monitor-upsert branch November 27, 2023 11:05
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Sentry CLI docs with monitor upsert instructions
4 participants