-
Notifications
You must be signed in to change notification settings - Fork 257
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
refactor(auth, gateway): use user_id over account_name #1674
Conversation
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.
Seems good. The metrics notes can be ignored - I just want to make sure we update them all
delete(delete_subscription), | ||
) | ||
.route_layer(from_extractor::<Metrics>()) | ||
.layer( | ||
TraceLayer::new(|request| { | ||
request_span!( | ||
request, | ||
request.params.account_name = field::Empty, | ||
request.params.user_id = field::Empty, |
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.
Note: this will affect metrics
common/src/backends/headers.rs
Outdated
@@ -33,15 +33,15 @@ impl Header for XShuttleAdminSecret { | |||
} | |||
} | |||
|
|||
pub static X_SHUTTLE_ACCOUNT_NAME: HeaderName = HeaderName::from_static("x-shuttle-account-name"); | |||
pub static X_SHUTTLE_USER_ID: HeaderName = HeaderName::from_static("x-shuttle-user-id"); |
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.
Changing the header name will break old deployers iirc. So we can't do that
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 one is only used between auth and gateway, so we can. Nevermind, it is being used for setting the account.name
trace field in deployer. However, if we're changing the value that is going to be recorded there (user_xyz
instead of github-123
), then it makes sense to change the name of the field (like I have in https://github.com/shuttle-hq/shuttle/pull/1674/files#diff-223aa4e48caca5d2fae2a4a306bcd0c99b8480713749f509eb60e858b9f73c04R166). Old deployers don't fail if it goes missing. It is possible to set both the old and new names+values of this header for backwards compat (it becomes pretty ugly tho... we can instead set both fields to the new user id, which is much simpler. Edit: did it).
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.
Fixed in 1edf407
let posthog_client = state.posthog_client.clone(); | ||
tokio::spawn(async move { | ||
let event = async_posthog::Event::new("shuttle_api_start_deployment", &account_name); | ||
let event = async_posthog::Event::new("shuttle_api_start_deployment", &user_id); |
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.
Note: will affect metrics
@@ -869,9 +869,9 @@ impl ApiBuilder { | |||
TraceLayer::new(|request| { | |||
request_span!( | |||
request, | |||
account.name = field::Empty, | |||
account.user_id = field::Empty, |
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.
Note: will affect metrics
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.
The code changes LGTM, but we should figure out exactly how our metrics will be affected by these changes, and what we will need to do after the release.
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.
Quick extra question
This reverts commit 0be50c3.
only: main | ||
# filters: | ||
# branches: | ||
# only: main |
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.
reminder
This reverts commit bc82a89.
Description of change
How has this been tested? (if applicable)
✔️ = tested