-
Notifications
You must be signed in to change notification settings - Fork 145
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: sync checkin configuration from config file #508
Conversation
Consistency is important! The
I had the same dilemma. I ended up following shalvah's suggestion on this structure: |
- I've moved a couple of methods from cli/main to the helper module to prevent duplication - I've made sure personal_auth_token can be set by env var - A couple more Checkin > CheckIn renames
@subzero10 I've renamed everything, praised be ye global rename feature of the editors. I've also added the tabular output of the sync results which was missing. I'm planning on doing a couple of manual tests this afternoon to be sure I am not fooled by all the mocking and stubbing. I think you mentioned changing the signature of the actual check_in method so that it allows names instead of the id, but I'd love to do that in a separate PR if that's okay, this is big enough as is. |
OK, that works! Btw, it should allow both name or id (i.e it should not break any existing behavior). Here's how it was done for the JS implementation. |
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.
This looks nice! I left a few comments!
Is a WIP as I'm moving between machines.
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.
LGTM. I'd like @joshuap to take a look, too.
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.
I think this works as it is, but I left a few of comments.
@subzero10 PTAL |
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.
This looks good to me!
@halfbyte Reminder that we also have to do the following when this PR is merged:
|
Yup :) |
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.
Looking good! I'm not necessarily requesting changes here, but I have a few questions which may result in changes (and I made a few small code suggestions). :)
Another random thought I just had: I see we're using the project_id
from the check_ins
config everywhere. Have you considered defaulting to the project api_key
if people exclude the project_id
? We'd have to either invent a way to fetch the real project_id
to use for substitution, or we'd have to support the project api_key
in addition to the project_id
in the REST API. I don't love either of those options, but I do like the experience of Honeybadger already knowing what my project is, since it already has my project API key (and most people will use this with a single project). 🤔
As you said, the
Is this possible with the current API?
I think I like this idea.
True. If we come to a solution with what you suggest above, we'll lose this multi-project check-ins possibility, but that's something I'm perfectly fine with. Update: Another idea I had in mind was to allow setting |
This crossed my mind too! It might be nice if you could set a top-level default that you could optionally override in each check-in. I also like the idea of not having to specify the project id (and personal access token?) at all, though. That said, I don't think we can grant any sort of read access to the project
Nope, it's not possible today, afaik. |
😄 Heh, I was so close to doing exactly this (top-level default
👍 Good point, I guess the personal auth token needs to stay.
Do you think we can go ahead with the following?
|
Co-authored-by: Joshua Wood <[email protected]>
Co-authored-by: Joshua Wood <[email protected]>
Co-authored-by: Joshua Wood <[email protected]>
@subzero10 @joshuap I think I followed your conversation about the |
I think this is OK for syncing things, and is a nicer default experience. Since we already have the per-check-in I'm less certain about performing check-ins. I'd really like to keep it so that we don't need to perform an extra request when actually performing a check in, as discussed in #509. Is that relevant here? |
I don't think there are any conclusion to draw just yet, we just need to hash this out before moving forward! 😄 |
|
||
def http_headers(headers = nil) | ||
{}.tap do |hash| | ||
hash.merge!(HEADERS) |
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.
@halfbyte Just to be clear—we want all of these requests to have the Content-Type
, Content-Encoding
, Accept
headers?
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.
- Content-Type - Needed
- Content-Encoding - Works with the Rest API. Maybe it would be desirable to switch it off as it makes testing a tiny bit easier, on the other hand, you know, compression.
- Accept: Makes sense to me?
- User-Agent: Makes sense, I guess?
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.
Thanks! And yeah, I think User-Agent
definitely makes sense.
Hey all, an update on this PR: We're going to hold off on merging this for now, and I may close it at some point—but we may pick it back up next year. We just have other priorities to focus on for the moment. In the meantime, I would like to finish the discussions we are having here so that we'll be in a good place to move forward if/when we come back to it. So let's continue discussing the details on the few unresolved threads above, but otherwise we can shift focus to other projects. (@stympy and @subzero10 — please ignore the review requests above, I was just resetting the approvals.) |
Since we now have the ability to map a project api key to a project id (https://github.com/honeybadger-io/honeybadger/pull/4368), I would vote to remove entirely If we were to change something in the PR, it would be:
For performing check-ins, we will use api key and slug to construct the check-in url, which can be done separately for #509. |
This works for me. 👍
See my #509 (comment) for one more suggestion—can we use the slug instead of the name as the sync identifier when the check-in ID isn't available? This would reduce the check-in name to just a label again, which I think is better—people might want to rename them without affecting sync. (Let me know if I'm missing something here.)
Yep, I think this a nicer experience—you don't need to worry about project_id at all as the user. 👍 |
No you are not missing anything, one of the reasons to make slug required is because we will use it to sync the check-ins as well. I just forgot to type it in the changes to be made! I will modify the PR description and add the complete list of remaining todo items. |
Closing this since we don't have the bandwidth currently. We'll keep the branch around and create a new PR if/when we resume this feature. Thanks everyon! |
Fixes #496
checkin
should becheck_in
everywhere. I took inspiration from @subzero10's PRs on JS and Laravel where he consistently usedcheckin
but both the API and the existing ruby code (for the actual check_in process) use the two word form. I'm happy to do the refactoring if we think that internal consistency is more importanthoneybadger checkins sync
orhoneybadger sync checkins
instead and I didn't yet read the docs on how to build subcommands with Thor.TODO
project_id
from configslug
to be presentname
optional (make sure to test this because it's not clear in the API doc whether it's optional)slug
instead ofname
to check-in, by constructing the check-in url with API key and slug