[PR #1309] [CLOSED] add prometheus metrics #1374

Closed
opened 2025-11-09 10:11:43 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/imputnet/cobalt/pull/1309
Author: @hyperdefined
Created: 6/2/2025
Status: Closed

Base: mainHead: prometheus


📝 Commits (8)

  • df2dcbc feat: add prometheus metrics
  • ad7d78a feat: allow port change of metrics
  • 69ca909 api/core: expose metrics status
  • c9dc352 api/core: redirect all other requests to metrics
  • 0e8c527 docs/api-env-variables: add metrics vars
  • 77c4e13 api/core: bind on localhost
  • 87b92a7 metrics: support clusters
  • db7930e metrics: make sure we listen correctly

📊 Changes

7 files changed (+159 additions, -9 deletions)

View changed files

📝 api/package.json (+1 -0)
📝 api/src/core/api.js (+41 -2)
📝 api/src/core/env.js (+3 -0)
api/src/misc/metrics.js (+50 -0)
📝 api/src/processing/match.js (+6 -0)
📝 docs/api-env-variables.md (+21 -0)
📝 pnpm-lock.yaml (+37 -7)

📄 Description

this PR adds prometheus compatible metrics. this is a replacement PR for #436.

  • failed/successful requests to each service
  • total http requests and durations
  • add metrics status to api JSON
  • enable with env, customize port (local to the container/host)

this does have some issues, like if the stream returns 0, it doesn't count it as an error (should look into).

this shouldn't break privacy policy, as nothing identifiable is tracked. however, instances that have it enabled should tell web to add it to the privacy policy, or include in popup about the instance.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/imputnet/cobalt/pull/1309 **Author:** [@hyperdefined](https://github.com/hyperdefined) **Created:** 6/2/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `prometheus` --- ### 📝 Commits (8) - [`df2dcbc`](https://github.com/imputnet/cobalt/commit/df2dcbc69dbfef4a0a994bc2de8c5e1c3baaeaa3) feat: add prometheus metrics - [`ad7d78a`](https://github.com/imputnet/cobalt/commit/ad7d78a9f16ac499de1d35dd93d67854ca0a006f) feat: allow port change of metrics - [`69ca909`](https://github.com/imputnet/cobalt/commit/69ca909e7dbc6726e007457adc8189e5ba94e353) api/core: expose metrics status - [`c9dc352`](https://github.com/imputnet/cobalt/commit/c9dc352f626cf14563511822936ba012364aff98) api/core: redirect all other requests to metrics - [`0e8c527`](https://github.com/imputnet/cobalt/commit/0e8c527982f245ed9192711ab2ed1792715dcd39) docs/api-env-variables: add metrics vars - [`77c4e13`](https://github.com/imputnet/cobalt/commit/77c4e134c7222226c702b98308c7ade27a3af30b) api/core: bind on localhost - [`87b92a7`](https://github.com/imputnet/cobalt/commit/87b92a7a624c3d8401d98c9218a00c03d4ddcac4) metrics: support clusters - [`db7930e`](https://github.com/imputnet/cobalt/commit/db7930eb8677224e1361a5348d35fb3c8214d844) metrics: make sure we listen correctly ### 📊 Changes **7 files changed** (+159 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `api/package.json` (+1 -0) 📝 `api/src/core/api.js` (+41 -2) 📝 `api/src/core/env.js` (+3 -0) ➕ `api/src/misc/metrics.js` (+50 -0) 📝 `api/src/processing/match.js` (+6 -0) 📝 `docs/api-env-variables.md` (+21 -0) 📝 `pnpm-lock.yaml` (+37 -7) </details> ### 📄 Description this PR adds prometheus compatible metrics. this is a replacement PR for #436. * failed/successful requests to each service * total http requests and durations * add metrics status to api JSON * enable with env, customize port (local to the container/host) this does have some issues, like if the stream returns 0, it doesn't count it as an error (should look into). this shouldn't break privacy policy, as nothing identifiable is tracked. however, instances that have it enabled should tell web to add it to the privacy policy, or include in popup about the instance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-09 10:11:43 -06:00
Sign in to join this conversation.