mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[misc] enable compression for the /metrics route
This commit is contained in:
parent
b6b65b9638
commit
71ba4150fe
2 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
let Metrics;
|
let Metrics;
|
||||||
console.log("using prometheus");
|
console.log("using prometheus");
|
||||||
|
|
||||||
|
const ExpressCompression = require('compression');
|
||||||
const prom = require('./prom_wrapper');
|
const prom = require('./prom_wrapper');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -75,7 +76,9 @@ module.exports = (Metrics = {
|
||||||
},
|
},
|
||||||
|
|
||||||
injectMetricsRoute(app) {
|
injectMetricsRoute(app) {
|
||||||
return app.get('/metrics', function(req, res) {
|
return app.get('/metrics', ExpressCompression({
|
||||||
|
level: parseInt(process.env.METRICS_COMPRESSION_LEVEL || '1', 10)
|
||||||
|
}), function (req, res) {
|
||||||
res.set('Content-Type', prom.registry.contentType);
|
res.set('Content-Type', prom.registry.contentType);
|
||||||
return res.end(prom.registry.metrics());
|
return res.end(prom.registry.metrics());
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"@google-cloud/debug-agent": "^3.0.0",
|
"@google-cloud/debug-agent": "^3.0.0",
|
||||||
"@google-cloud/profiler": "^0.2.3",
|
"@google-cloud/profiler": "^0.2.3",
|
||||||
"@google-cloud/trace-agent": "^3.2.0",
|
"@google-cloud/trace-agent": "^3.2.0",
|
||||||
|
"compression": "^1.7.4",
|
||||||
"prom-client": "^11.1.3",
|
"prom-client": "^11.1.3",
|
||||||
"underscore": "~1.6.0",
|
"underscore": "~1.6.0",
|
||||||
"yn": "^3.1.1"
|
"yn": "^3.1.1"
|
||||||
|
|
Loading…
Reference in a new issue