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

ref: Remove actix-web in favor of axum (NATIVE-193) #544

Merged
merged 12 commits into from
Sep 8, 2021
Merged

ref: Remove actix-web in favor of axum (NATIVE-193) #544

merged 12 commits into from
Sep 8, 2021

Conversation

Swatinem
Copy link
Member

@Swatinem Swatinem commented Aug 31, 2021

Still needs a bit of work, there are a few TODOs scattered around, but it already gets rid of old actix/futures/tokio.

There are a few changes from the current actix implementation:

  • Errors are serialized via ApiResponseError or however it is called, this might be good to do as a followup refactor.
  • The vendored senty-actix integration used to capture server errors
  • The old code imposed some limits on JSON and multipart bodies, the new code does not. I think we can just drop this, as sentry pushes requests to symbolicator, so they should be well formed.
  • The vendored sentry actix integration attached some event attributes, like request url, headers, etc, not sure how useful it is?

@Swatinem Swatinem requested a review from a team August 31, 2021 08:42
@Swatinem Swatinem marked this pull request as ready for review August 31, 2021 16:37
crates/symbolicator/Cargo.toml Outdated Show resolved Hide resolved
crates/symbolicator/src/endpoints/minidump.rs Outdated Show resolved Hide resolved
use axum::http::{Response, StatusCode};
use axum::response::IntoResponse;
use axum::Router;
use sentry::integrations::tower::NewSentryLayer;
Copy link
Contributor

Choose a reason for hiding this comment

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

where does this live?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was done recently.
getsentry/sentry-rust#356
It is the reason why this pulls in sentry-rust via git. I think we should be able to cut a release for that any time.

crates/symbolicator/src/main.rs Outdated Show resolved Hide resolved
crates/symbolicator/src/test.rs Show resolved Hide resolved
Comment on lines +15 to +21
pub use error::ResponseError;

use applecrashreport::handle_apple_crash_report_request as applecrashreport;
use minidump::handle_minidump_request as minidump;
use proxy::proxy_symstore_request as proxy;
use requests::poll_request as requests;
use symbolicate::symbolicate_frames as symbolicate;
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking: Isn't this section above the mod section normally? Also the pub use one should be the bottom of this section afaik https://www.notion.so/sentry/HOWTO-Code-Rust-at-Sentry-7b35f165b10b4492bb95ebe1471a9ada#57304f11240944338fe3828059bcf463

}

impl<F> SentryFutureExt for F where F: futures01::future::Future {}

/// Write own data to [`sentry::Scope`], only the subset that is considered useful for debugging.
pub trait ConfigureScope {
Copy link
Contributor

Choose a reason for hiding this comment

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

lol, I've never liked this trait and wouldn't mind if this goes away too. but doesn't matter for this PR

@flub
Copy link
Contributor

flub commented Sep 3, 2021

I'm kind of in favour of still resolving the two unticked issues in the description.

Swatinem and others added 2 commits September 3, 2021 14:38
Implement file streaming and limits on multipart filesizes
}

fn call(&mut self, request: Request<Body>) -> Self::Future {
sentry::configure_scope(|scope| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we turn the future returned from self.service.call() into a SentryFuture and use with_scope instead so that this is all popped back off the scope when this is done?

Copy link
Member Author

Choose a reason for hiding this comment

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

The sentry-tower layer makes sure that every request gets its own fresh hub and scope, and if I understand the tower concepts correctly, all child layers/routes get the correct hub.

Comment on lines 50 to 52
fn get_str(val: &HeaderValue) -> Option<&str> {
val.to_str().ok()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

heh, i would never have thought of writing this as an fn rather than a closure. but that makes total sense.

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

Please make a followup task for the 5Mb limit of the symbolicate request body before merging.

@Swatinem
Copy link
Member Author

Swatinem commented Sep 8, 2021

I filed that as https://getsentry.atlassian.net/browse/NATIVE-207 as a separate backlog task so it does not block us from marking the parent task as "done".

@Swatinem Swatinem merged commit b6ef7cb into master Sep 8, 2021
@Swatinem Swatinem deleted the axum branch September 8, 2021 14:22
relaxolotl added a commit that referenced this pull request Sep 9, 2021
The 5MB limit to "/symbolicate" bodies was removed in #544,
which was a major refactor. This restores that limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants