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

Add in flight request metrics #3252

Merged
merged 3 commits into from
May 22, 2018
Merged

Conversation

erikjohnston
Copy link
Member

This tracks CPU and DB usage while requests are in flight, rather than
when we write the response.

This tracks CPU and DB usage while requests are in flight, rather than
when we write the response.
@erikjohnston erikjohnston force-pushed the erikj/in_flight_requests branch from 7d04cd8 to dfa70ad Compare May 21, 2018 15:23
)


# The set of all in flight requests.
Copy link
Member

Choose a reason for hiding this comment

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

could you give this some type info: in particular that it contains _RequestMetricses?

counts[key] = counts.get(key, 0) + 1

for (method, name), count in counts.iteritems():
_in_flight_requests_count.set(count, method, name)
Copy link
Member

Choose a reason for hiding this comment

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

will this not end up with stale results, because we never properly clear it?

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 gets run before every call to /metrics, so should be fine. OTOH we may as well make it clearer by using a callback metrics

Copy link
Member

Choose a reason for hiding this comment

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

yes, but we'll still end up with stale items in _in_flight_requests_count ?

+1 to fixing with a callbackmetrics


def __init__(self, context, ru_utime, ru_stime, db_txn_count,
db_txn_duration_ms, db_sched_duration_ms):
self.context = context
Copy link
Member

Choose a reason for hiding this comment

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

is this actually used anywhere? I can't see it

Copy link
Member Author

Choose a reason for hiding this comment

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

It's mainly used in update to allow it to call from_context

Copy link
Member

Choose a reason for hiding this comment

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

oh yes. Why not pass it through from RequestMetrics, since that already knows the context? It would distinguish more clearly between the data (_RequestStats) and the thing to manage it (RequestMetrics)

@richvdh richvdh assigned erikjohnston and unassigned richvdh May 21, 2018
@erikjohnston erikjohnston assigned richvdh and unassigned erikjohnston May 22, 2018
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

@richvdh richvdh assigned erikjohnston and unassigned richvdh May 22, 2018
@erikjohnston erikjohnston merged commit 13a8dfb into develop May 22, 2018
@erikjohnston erikjohnston deleted the erikj/in_flight_requests branch September 20, 2018 13:58
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