Jakob Ackermann 0b985c7a0b Merge pull request #12723 from overleaf/jpa-revert-node-18-upgrade %!s(int64=3) %!d(string=hai) anos
..
.circleci 2f35db4087 Fix startup crash %!s(int64=6) %!d(string=hai) anos
test 74eeec2ba3 Merge pull request #11680 from overleaf/em-mongo-pool-monitoring %!s(int64=3) %!d(string=hai) anos
.dockerignore 8945373715 Merge pull request #5724 from overleaf/jpa-lean-docker-build %!s(int64=4) %!d(string=hai) anos
.gitignore 23efa1d977 [misc] prepare for monorepo %!s(int64=5) %!d(string=hai) anos
.npmignore 0fdbb2dcc0 Add .npmignore to avoid publishing config files %!s(int64=6) %!d(string=hai) anos
.nvmrc 0b985c7a0b Merge pull request #12723 from overleaf/jpa-revert-node-18-upgrade %!s(int64=3) %!d(string=hai) anos
CHANGELOG.md c94043e2fe Merge pull request #10144 from overleaf/ii-metrics-api-patch-opts-arg %!s(int64=4) %!d(string=hai) anos
LICENSE 60857982b6 Create LICENSE %!s(int64=12) %!d(string=hai) anos
README.md d9d65ac31c Merge pull request #5246 from overleaf/bg-upgrade-logger-in-all-libraries %!s(int64=5) %!d(string=hai) anos
buildscript.txt 0b985c7a0b Merge pull request #12723 from overleaf/jpa-revert-node-18-upgrade %!s(int64=3) %!d(string=hai) anos
event_loop.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages %!s(int64=4) %!d(string=hai) anos
http.js efcb06f0df Merge pull request #7905 from overleaf/em-request-logging %!s(int64=4) %!d(string=hai) anos
index.js 74eeec2ba3 Merge pull request #11680 from overleaf/em-mongo-pool-monitoring %!s(int64=3) %!d(string=hai) anos
memory.js e0d91eaa26 Merge pull request #7906 from overleaf/em-downgrade-logs %!s(int64=4) %!d(string=hai) anos
mongodb.js 74eeec2ba3 Merge pull request #11680 from overleaf/em-mongo-pool-monitoring %!s(int64=3) %!d(string=hai) anos
open_sockets.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages %!s(int64=4) %!d(string=hai) anos
package.json 5f69488f67 Merge pull request #12369 from overleaf/csh-issue-4497-bump-profiler %!s(int64=3) %!d(string=hai) anos
prom_wrapper.js 5683cebf71 Merge pull request #11679 from overleaf/em-upgrade-prom-client %!s(int64=3) %!d(string=hai) anos
timeAsyncMethod.js e0d91eaa26 Merge pull request #7906 from overleaf/em-downgrade-logs %!s(int64=4) %!d(string=hai) anos
tracing.js 50b346b4ed Merge pull request #10279 from overleaf/jpa-tracing-optimizations %!s(int64=3) %!d(string=hai) anos
uv_threadpool_size.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages %!s(int64=4) %!d(string=hai) anos

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('@overleaf/logger')
...
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