Brian Gough fa2567aa61 Merge pull request #4980 from overleaf/bg-upgrade-metrics-dependencies 5 лет назад
..
.circleci 2f35db4087 Fix startup crash 5 лет назад
test 6a0388ff9b Merge pull request #4689 from overleaf/jpa-libraries-ci 5 лет назад
.eslintrc 971a768c4e Install prettier and eslint 6 лет назад
.gitignore 23efa1d977 [misc] prepare for monorepo 5 лет назад
.npmignore 0fdbb2dcc0 Add .npmignore to avoid publishing config files 5 лет назад
.prettierrc 971a768c4e Install prettier and eslint 6 лет назад
LICENSE 60857982b6 Create LICENSE 12 лет назад
README.md acef9e7d8d Add basic README 5 лет назад
buildscript.txt 6a0388ff9b Merge pull request #4689 from overleaf/jpa-libraries-ci 5 лет назад
event_loop.js 971a768c4e Install prettier and eslint 6 лет назад
http.js 8dcbd5aec0 Add support for the swagger-tools router 5 лет назад
index.js 29742d6a87 [misc] register the metrics sweeping interval handle for later cleanup 5 лет назад
memory.js 971a768c4e Install prettier and eslint 6 лет назад
mongodb.js 971a768c4e Install prettier and eslint 6 лет назад
open_sockets.js 2d1c84ea2e [misc] fix collection of open sockets 5 лет назад
package-lock.json fa2567aa61 Merge pull request #4980 from overleaf/bg-upgrade-metrics-dependencies 5 лет назад
package.json fa2567aa61 Merge pull request #4980 from overleaf/bg-upgrade-metrics-dependencies 5 лет назад
prom_wrapper.js 20223d865f [misc] do not register a noop sweeping interval 5 лет назад
timeAsyncMethod.js 971a768c4e Install prettier and eslint 6 лет назад
uv_threadpool_size.js 971a768c4e Install prettier and eslint 6 лет назад

README.md

overleaf/metrics-module

Wrappers the prom-client npm module to provide Prometheus metrics at /metrics.

Use:

const metrics = require('@overleaf/metrics')
metrics.initialize('myapp')

const express = require('express')
const app = express()
metrics.injectMetricsRoute(app)

Request logging can be enabled:

const logger = require('logger-sharelatex')
...
app.use(metrics.http.monitor(logger))

The metrics module can be configured through the following environment variables:

  • DEBUG_METRICS - enables display of debugging messages to the console.
  • ENABLE_TRACE_AGENT - enables @google-cloud/trace-agent on Google Cloud
  • ENABLE_DEBUG_AGENT - enables @google-cloud/debug-agent on Google Cloud
  • ENABLE_PROFILE_AGENT - enables @google-cloud/profiler on Google Cloud
  • METRICS_COMPRESSION_LEVEL - sets the compression level for /metrics
  • STACKDRIVER_LOGGING - toggles the request logging format
  • UV_THREADPOOL_SIZE - sets the libuv thread pool size