Jakob Ackermann 264b107e39 Merge pull request #6927 from overleaf/jpa-split-clsi-metrics il y a 4 ans
..
.circleci 2f35db4087 Fix startup crash il y a 5 ans
test 264b107e39 Merge pull request #6927 from overleaf/jpa-split-clsi-metrics il y a 4 ans
.dockerignore 8945373715 Merge pull request #5724 from overleaf/jpa-lean-docker-build il y a 4 ans
.gitignore 23efa1d977 [misc] prepare for monorepo il y a 5 ans
.npmignore 0fdbb2dcc0 Add .npmignore to avoid publishing config files il y a 5 ans
.nvmrc 8789296f5a Merge pull request #6481 from overleaf/jpa-node-14-18-3 il y a 4 ans
CHANGELOG.md c5778fdd05 Merge pull request #5488 from overleaf/em-refactor-logger il y a 4 ans
LICENSE 60857982b6 Create LICENSE il y a 12 ans
README.md d9d65ac31c Merge pull request #5246 from overleaf/bg-upgrade-logger-in-all-libraries il y a 4 ans
buildscript.txt ae0c347f27 Merge pull request #6542 from overleaf/jpa-em-code-sharing-workspaces il y a 4 ans
event_loop.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
http.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
index.js 264b107e39 Merge pull request #6927 from overleaf/jpa-split-clsi-metrics il y a 4 ans
memory.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
mongodb.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
open_sockets.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
package.json ae0c347f27 Merge pull request #6542 from overleaf/jpa-em-code-sharing-workspaces il y a 4 ans
prom_wrapper.js 264b107e39 Merge pull request #6927 from overleaf/jpa-split-clsi-metrics il y a 4 ans
timeAsyncMethod.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans
uv_threadpool_size.js 4b308553be Merge pull request #6120 from overleaf/jpa-same-linting-packages il y a 4 ans

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