Add Prometheus metrics endpoint - #923
Merged
ogazboiz merged 2 commits intoMay 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces Prometheus metrics support to the backend service, enabling improved observability and monitoring. It adds the
prom-clientdependency, implements metrics middleware and a/metricsendpoint 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
prom-clientpackage and its dependencytdigesttopackage.jsonandpackage-lock.jsonto 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))metricsMiddlewareandmetricsHandlerinmiddleware/metrics.js, and registered them in the Express app to collect and expose metrics at/metrics, protected by an internal API key viarequireApiKey. ([[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))metrics.test.tsto 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
package-lock.jsonto 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