overleaf/libraries/metrics
Jakob Ackermann a2cf7b459c Merge pull request #14902 from overleaf/jpa-node-18-18-0
[misc] upgrade Node.js to latest LTS 18.18.0

GitOrigin-RevId: 96c7171065ceb8797c28efa4ab331d86a84868d2
2023-09-25 08:04:25 +00:00
..
.circleci
test
.dockerignore
.gitignore
.npmignore
.nvmrc Merge pull request #14902 from overleaf/jpa-node-18-18-0 2023-09-25 08:04:25 +00:00
buildscript.txt Merge pull request #14902 from overleaf/jpa-node-18-18-0 2023-09-25 08:04:25 +00:00
CHANGELOG.md
event_loop.js
http.js
index.js
leaked_sockets.js
LICENSE
memory.js
mongodb.js
open_sockets.js
package.json Merge pull request #14903 from overleaf/revert-14869-revert-14603-td-upgrade-semver 2023-09-21 08:03:43 +00:00
prom_wrapper.js
README.md
timeAsyncMethod.js
tracing.js Merge pull request #14903 from overleaf/revert-14869-revert-14603-td-upgrade-semver 2023-09-21 08:03:43 +00:00
uv_threadpool_size.js

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