Skip to content

middleware::log_request: Split request timing code into dedicated middleware #4116

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

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Nov 2, 2021

This is generic and not strictly related to the LogRequest middleware. The UpdateMetrics middleware should probably also use this in the future.

@Turbo87 Turbo87 added A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear labels Nov 2, 2021
@Turbo87 Turbo87 requested review from pietroalbini and locks November 2, 2021 11:54
@bors
Copy link
Contributor

bors commented Nov 3, 2021

☔ The latest upstream changes (presumably #4115) made this pull request unmergeable. Please resolve the merge conflicts.

@Turbo87 Turbo87 requested a review from JohnTitor November 3, 2021 08:05
Comment on lines +155 to +158
if let Some(response_time) = response_time {
if response_time.as_millis() > SLOW_REQUEST_THRESHOLD_MS {
line.add_marker("SLOW REQUEST")?;
}
Copy link
Member

Choose a reason for hiding this comment

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

We could de-duplicate this if let by merging it into the above if let or binding response_time.

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 problem with merging them is that it changes the field order

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see, then it should be fine. Thanks for clarifying!

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 3, 2021

📌 Commit 775a75a has been approved by JohnTitor

@bors
Copy link
Contributor

bors commented Nov 3, 2021

⌛ Testing commit 775a75a with merge 8e4ddf9...

@bors
Copy link
Contributor

bors commented Nov 3, 2021

☀️ Test successful - checks-actions
Approved by: JohnTitor
Pushing 8e4ddf9 to master...

@bors bors merged commit 8e4ddf9 into rust-lang:master Nov 3, 2021
@Turbo87 Turbo87 deleted the timing-middleware branch November 3, 2021 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants