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

Add prometheus metric for the number of requests in flight. #87

Merged
merged 5 commits into from
Mar 24, 2020

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Mar 23, 2020

Based on #85

By having a FakeChannel instead of a DummyRequest, we can make sure that
functionality which relies on our own Request impl works correctly.
@richvdh richvdh requested a review from a team March 23, 2020 22:49
@erikjohnston erikjohnston changed the title Fix a bug which meant that requests were logged with an invalid timestamp Add prometheus metric for the number of requests in flight. Mar 24, 2020
)
async def cb():
with request.processing():
await self._handle_dispatch(root_span, request, log, notif, context)
Copy link
Member

Choose a reason for hiding this comment

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

Can we not just instead do:

with REQUESTS_IN_FLIGHT_GUAGE.track_inprogress():
    await self._handle_dispatch(root_span, request, log, notif, context)

rather than having the request itself track what's going on? Or can we finish the request independently of the _handle_dispatch?

Copy link
Member Author

Choose a reason for hiding this comment

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

well, the intention was to lay the groundwork for tracking requests in progress when we have other servlets which don't necessarily follow the same pattern. In principle, yes we can finish a request independently of the async handler - for example if we hand over control to a Producer to stream back a response.

In practice, we dont' do that anywhere in sygnal and honestly I guess it's unlikely that we ever will. So yeah, this is over-engineered. I'll simplify it.

realistically, we just need to bump the metric around the async handler.
@richvdh richvdh merged commit 7b6e798 into master Mar 24, 2020
@richvdh richvdh deleted the rav/in_flight_metrics branch March 24, 2020 15:45
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.

2 participants