Miguel Serrano a3ec5b2797 Merge pull request #30018 from overleaf/msm-fix-esm-import há 10 meses atrás
..
test fd0d21fbbd [monorepo] migrate build scripts to Jenkins (#29019) há 1 ano atrás
.mocharc.cjs fd0d21fbbd [monorepo] migrate build scripts to Jenkins (#29019) há 1 ano atrás
.npmignore 0fdbb2dcc0 Add .npmignore to avoid publishing config files há 6 anos atrás
.nvmrc 6190005f9b [monorepo] Upgrade to node 22.18.0 (#27977) há 1 ano atrás
CHANGELOG.md c94043e2fe Merge pull request #10144 from overleaf/ii-metrics-api-patch-opts-arg há 4 anos atrás
LICENSE 63520c7076 Merge pull request #16859 from overleaf/jpa-sharelatex-cleanup há 2 anos atrás
README.md 5855ba7b49 Merge pull request #15241 from overleaf/em-gcp-opentelemetry há 3 anos atrás
buildscript.txt 74efa0e345 Merge pull request #29898 from overleaf/gs-jenkins-issues-all-pipelines há 10 meses atrás
event_loop.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages há 4 anos atrás
http.js 7aa66b260c Merge pull request #28541 from overleaf/td-notifications-app-ts há 1 ano atrás
index.js 84c3dc1fff Merge pull request #17268 from overleaf/dp-remove-old-mongo-metrics há 2 anos atrás
initialize.js 9a2847dbee [web] Add startup metrics (#25277) há 1 ano atrás
leaked_sockets.js 7f48c67512 Add `prefer-node-protocol` ESLint rule (#21532) há 1 ano atrás
memory.js e0d91eaa26 Merge pull request #7906 from overleaf/em-downgrade-logs há 4 anos atrás
mongodb.js 56f70b3246 Support v5 of mongodb when recording metrics há 2 anos atrás
open_sockets.js 7f48c67512 Add `prefer-node-protocol` ESLint rule (#21532) há 1 ano atrás
package.json 729e0f5ac9 move migrations to shared location (#28306) há 1 ano atrás
prom_wrapper.js 5683cebf71 Merge pull request #11679 from overleaf/em-upgrade-prom-client há 3 anos atrás
tsconfig.json 423c2a47e5 Merge pull request #28482 from overleaf/ar-move-notifications-changes-into-buildscripts há 1 ano atrás
uv_threadpool_size.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages há 4 anos atrás

README.md

overleaf/metrics-module

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

Use:

// Metrics must be initialized before importing anything else
require('@overleaf/metrics/initialize')

const express = require('express')
const metrics = require('@overleaf/metrics')
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.
  • GCP_OPENTELEMETRY - enables OpenTelemetry tracing for GCP
  • JAEGER_OPENTELEMETRY - enables OpenTelemetry tracing for Jaeger (in the dev environment)
  • METRICS_APP_NAME - the app label for metrics and spans
  • 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