Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Correctly account for cpu usage by background threads #4074

Merged
merged 3 commits into from
Oct 23, 2018

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Oct 19, 2018

Wrap calls to deferToThread() in a thing which uses a child logcontext to
attribute CPU usage to the right request.

While we're in the area, remove the logcontext_tracer stuff, which is never
used, and afaik doesn't work.

Fixes #4064

Wrap calls to deferToThread() in a thing which uses a child logcontext to
attribute CPU usage to the right request.

While we're in the area, remove the logcontext_tracer stuff, which is never
used, and afaik doesn't work.

Fixes #4064
@richvdh richvdh requested a review from a team October 19, 2018 21:26
@richvdh
Copy link
Member Author

richvdh commented Oct 20, 2018

looks like this breaks things :/

@richvdh richvdh removed the request for review from a team October 20, 2018 01:20
@richvdh richvdh requested a review from a team October 22, 2018 11:40
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Can we do something to reduce the boiler plate? It makes it hard to follow if everything starts with self.hs.get_reactor(), self.hs.get_reactor().getThreadPool(). Could we maybe make defer_to_threadpool take a hs object? Or even just the reactor and call getThreadPool() on it inside the function?

Otherwise looks good.

add another wrapper which removes the getThreadPool boilerplate
@richvdh
Copy link
Member Author

richvdh commented Oct 23, 2018

fair point. ptal.

@richvdh richvdh requested a review from erikjohnston October 23, 2018 12:02
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Thanks, that seems more readable 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants