Add request_duration_seconds metric #72
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "metrics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds a new
request_duration_secondsmetrics, which records a histogram of the request latency, partitioned by status code and HTTP method.This PR also refactors other parts of the
metrics.gofile.46f26664a4toea8c22c37cea8c22c37cto0321bb72dc@ -45,0 +47,4 @@// partitioned by type and state.//// Its values are computed on the fly by updateMetrics().var metricURLsTotalGauge = prometheus.NewGaugeVec((technically, the PR is for
request_duration_seconds, so anything other than that should be omitted... or change the PR title and description)@ -61,0 +86,4 @@for state := db.PasteStateUndef; state <= db.PasteStateDeleted; state++ {for ty := db.PasteTypeUndef; ty <= db.PasteTypeFileUpload; ty++ {var count int64query := mh.db.Unscoped().Model(&db.Paste{}).Where("type = ? AND state = ?", ty, state).Count(&count)Is it possible to query the database once, yielding all counts for all types and states?
I tried to find this, but thought it was not not possible. I have retried searching for this and found this: https://stackoverflow.com/a/19046871/5207081
That would fix this.
Ran this query on the test migration database:
Would that roughly be what you expect to get here?
See the other review comments.
0321bb72dctoc4ff0ab1b7ccd9d2f110to306705cb28Live.