-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: Added cron specific endpoint #2153
Changes from 1 commit
cbd1e4d
c78de46
4261abe
3cb68e7
1ea9281
ec22c0f
867f076
8ba655c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import base64 | ||
|
||
|
||
def generate_check_in(slug): | ||
return { | ||
"check_in_id": "a460c25ff2554577b920fcfacae4e5eb", | ||
|
@@ -26,3 +29,31 @@ def test_monitors_with_processing( | |
"status": "in_progress", | ||
"duration": 21.0, | ||
} | ||
|
||
|
||
def test_crons_endpoint_with_processing( | ||
mini_sentry, relay_with_processing, monitors_consumer | ||
): | ||
project_id = 42 | ||
options = {"processing": {}} | ||
relay = relay_with_processing(options) | ||
monitors_consumer = monitors_consumer() | ||
|
||
mini_sentry.add_full_project_config(project_id) | ||
|
||
monitor_slug = "my-monitor" | ||
public_key = relay.get_dsn_public_key(project_id) | ||
basic_auth = base64.b64encode((public_key + ":").encode("utf-8")).decode("utf-8") | ||
relay.post( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noticed, this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The endpoint supports either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah cool. I'll expand on POST in a future PR. |
||
"/api/cron/{}?status=ok".format(monitor_slug), | ||
headers={"Authorization": "Basic " + basic_auth}, | ||
) | ||
|
||
check_in, message = monitors_consumer.get_check_in() | ||
assert message["start_time"] is not None | ||
assert message["project_id"] == 42 | ||
assert check_in == { | ||
"check_in_id": "00000000000000000000000000000000", | ||
"monitor_slug": "my-monitor", | ||
"status": "ok", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the reason even to add basic auth?
Using basic auth is super confusion to me to be honest.
Especially when you look at the format users should use to make it work. And I talk about the part when you have yo prove the key (
curl -u sentry_key:
) this colon aftersentry_key
is super easy to miss and mess up your curl command. IMO it makes this very error-prone to the customer.Much easier and more explicit way would be to use the header which we support or path param, which is also supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're adding this as a bit of an experiment for crons to feel out the ergonomics and DX doing it this way.
I don't think we're planning to immediately tell customers to use this. I agree with the points you make though @olksdr, I think it's not unlikely this will get removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add the note here, which explains why this added and that this is just an experiment and will be removed in the follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olksdr fwiw I think basic auth should be generally supported, beyond this experiment, entirely independent of this. From the original
x-sentry-auth
header basically nothing remains and we already support auth purely by?sentry_key
in the URL. At this point I would honestly love to see us supporting justBearer
and basic auth with just the public key.cc @jan-auer