Skip to content

Add Prometheus metrics endpoint - #923

Merged
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
Obiajulu-gif:issue-860-prometheus-metrics
May 27, 2026
Merged

Add Prometheus metrics endpoint#923
ogazboiz merged 2 commits into
LabsCrypt:mainfrom
Obiajulu-gif:issue-860-prometheus-metrics

Conversation

@Obiajulu-gif

Copy link
Copy Markdown
Contributor

This pull request introduces Prometheus metrics support to the backend service, enabling improved observability and monitoring. It adds the prom-client dependency, implements metrics middleware and a /metrics endpoint protected by an internal API key, and provides comprehensive tests for the new metrics functionality. Several related dependencies are also added or updated to support this feature.

Prometheus Metrics Integration

  • Added the prom-client package and its dependency tdigest to package.json and package-lock.json to enable Prometheus metrics collection and exposition. ([[1]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-495707834ca4b862f9acdfbac70d279023d2c059da13db59594e61ed3354fed5R43), [[2]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR26), [[3]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR11018-R11030), [[4]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR12126-R12134), [[5]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR4493-R4498))
  • Implemented metricsMiddleware and metricsHandler in middleware/metrics.js, and registered them in the Express app to collect and expose metrics at /metrics, protected by an internal API key via requireApiKey. ([[1]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-8455472d7e00dd51813de7e63e5b214382a247990f84bf3fbed9fcc3af24ad6fR26-R32), [[2]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-8455472d7e00dd51813de7e63e5b214382a247990f84bf3fbed9fcc3af24ad6fR122), [[3]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-8455472d7e00dd51813de7e63e5b214382a247990f84bf3fbed9fcc3af24ad6fR166-R167))
  • Added a comprehensive test suite in metrics.test.ts to verify metrics collection, endpoint protection, and correct label usage. ([backend/src/__tests__/metrics.test.tsR1-R90](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-62459ca54948fc85c1ff2196b73270e0b8df67254649eb252ca0e714d93ca6baR1-R90))

Dependency and Package Metadata Updates

  • Marked many dependencies as peer dependencies in package-lock.json to improve dependency management and compatibility. ([[1]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR137), [[2]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2495), [[3]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2517), [[4]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2530), [[5]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2950), [[6]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2967), [[7]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR2985), [[8]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR3098), [[9]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR3656), [[10]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR3838), [[11]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR4088), [[12]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR4566), [[13]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR5721), [[14]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR5778), [[15]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR6201), [[16]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR10754), [[17]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR10946), [[18]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR12204), [[19]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR12363), [[20]](https://github.com/LabsCrypt/remitlend/pull/923/files#diff-f89763fc11c1bc48ac3c7ce8a148fbbbc5c2062393ee78664a70273d714daf5cR12608))

These changes collectively provide robust metrics support for the backend, allowing for real-time monitoring and integration with Prometheus-compatible observability stacks.

Closes #860

@ogazboiz
ogazboiz merged commit 4f387fa into LabsCrypt:main May 27, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Add /metrics Prometheus endpoint with indexer, queue, and HTTP counters

2 participants