Improve rate limit instrumentation
Created by: ryanslade
We should include the following in our rate limit metrics for GitHub and GitLab:
-
Consumed rate limit -
How much time we spent waiting for rate limiting in total -
How much time we spent waiting for rate limiting per-request -
How many requests we sent to the code host👇 -
How long requests to the code host took👇
On investigation, I found that we already track code host request counts and durations here: https://github.com/sourcegraph/sourcegraph/blob/main/internal/metrics/metrics.go#L36
Used here for example: https://github.com/sourcegraph/sourcegraph/blob/main/internal/extsvc/github/common.go#L35
Part of: https://github.com/sourcegraph/sourcegraph/issues/8100