This PR adds a new request_duration_seconds metrics, which records a histogram of the request latency, partitioned by status code and HTTP method.
This PR also refactors other parts of the metrics.go file.
This PR adds a new `request_duration_seconds` metrics, which records a histogram of the request latency, partitioned by status code and HTTP method.
This PR also refactors other parts of the `metrics.go` file.
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.
sqlite> SELECT type, state, COUNT(*) FROM pastes GROUP BY type, state;
0|2|136 // type: undef state: deleted
2|1|118 // type: redirect state: present
3|1|1376 // type: fileupload state: present
Would that roughly be what you expect to get here?
Ran this query on the test migration database:
```
sqlite> SELECT type, state, COUNT(*) FROM pastes GROUP BY type, state;
0|2|136 // type: undef state: deleted
2|1|118 // type: redirect state: present
3|1|1376 // type: fileupload state: present
```
Would that roughly be what you expect to get here?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.