mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Replace endpointHitCounter
Track summary statistic of total HTTP response durations using a middleware that applies for all requests instead of having every request needing to update the hit counter manually. Deprecates endpointHitCounter.
This commit is contained in:
1 parent
98dc0174d6
commit
5ad89f072f
7 files changed
+23
-24
No files matched your search
@@ -86,7 +86,7 @@ class MasterPlugin extends libPlugin.BaseMasterPlugin {
|
||||
|
||||
this.subscribedControlLinks = new Set();
|
||||
|
||||
routes.addApiRoutes(this.master.app, this.items, this.metrics.endpointHitCounter);
|
||||
routes.addApiRoutes(this.master.app, this.items);
|
||||
}
|
||||
|
||||
updateStorage() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
function addApiRoutes(app, items, endpointHitCounter) {
|
||||
function addApiRoutes(app, items) {
|
||||
|
||||
/**
|
||||
* GET endpoint to read the masters current inventory of items.
|
||||
@@ -10,7 +10,6 @@ function addApiRoutes(app, items, endpointHitCounter) {
|
||||
* @returns {object[]} JSON [{name:"iron-plate", count:100},{name:"copper-plate",count:5}]
|
||||
*/
|
||||
app.get("/api/inventory", (req, res) => {
|
||||
endpointHitCounter.labels(req.route.path).inc();
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
// Check it and send it
|
||||
@@ -31,7 +30,6 @@ function addApiRoutes(app, items, endpointHitCounter) {
|
||||
* @returns {object} JSON {"iron-plate":100, "copper-plate":5}
|
||||
*/
|
||||
app.get("/api/inventoryAsObject", (req, res) => {
|
||||
endpointHitCounter.labels(req.route.path).inc();
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
||||
// Check it and send it
|
||||
|
||||
Reference in new issue
Block a user