overleaf/libraries/metrics
Andrew Rumble 767591973c Merge pull request #23905 from overleaf/ar-mocha-11
[all] Bump mocha everywhere

GitOrigin-RevId: bf5587047f9ceb88872cbd356c2029717bb8ca9d
2025-02-28 09:05:40 +00:00
..
test Increase checkSummaryValues ranges to fix flakiness (#22227) 2024-12-02 09:06:22 +00:00
.dockerignore
.gitignore
.npmignore
.nvmrc Run bin/update_node 20.18.0 20.18.2 (#23074) 2025-01-24 09:06:05 +00:00
buildscript.txt Run bin/update_node 20.18.0 20.18.2 (#23074) 2025-01-24 09:06:05 +00:00
CHANGELOG.md
event_loop.js
http.js
index.js
initialize.js Add prefer-node-protocol ESLint rule (#21532) 2024-11-11 09:04:51 +00:00
leaked_sockets.js Add prefer-node-protocol ESLint rule (#21532) 2024-11-11 09:04:51 +00:00
LICENSE
memory.js
mongodb.js
open_sockets.js Add prefer-node-protocol ESLint rule (#21532) 2024-11-11 09:04:51 +00:00
package.json Merge pull request #23905 from overleaf/ar-mocha-11 2025-02-28 09:05:40 +00:00
prom_wrapper.js
README.md
tsconfig.json
uv_threadpool_size.js

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