Skip to content

Commit 7418c9a

Browse files
committed
feat: add inbound metrics for quotes and transfers (combined)
1 parent a0de2ba commit 7418c9a

File tree

18 files changed

+41879
-141
lines changed

18 files changed

+41879
-141
lines changed

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.9.4.cjs
7+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

CHANGELOG.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
# Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
2-
### [24.10.10](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.10.9...v24.10.10) (2025-08-27)
3-
4-
5-
### Bug Fixes
6-
7-
* **csi-1708:** updated deps ([#607](https://github.com/mojaloop/sdk-scheme-adapter/issues/607)) ([42f7baf](https://github.com/mojaloop/sdk-scheme-adapter/commit/42f7baf2e828e4eea2eb4edc41cd847d4e15651c))
8-
9-
10-
### Chore
11-
12-
* **sbom:** update sbom [skip ci] ([c05eac1](https://github.com/mojaloop/sdk-scheme-adapter/commit/c05eac19196b19b1b3ff3c6cafc0744207e4b43d))
13-
142
### [24.10.9](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.10.8...v24.10.9) (2025-08-18)
153

164

modules/api-svc/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mojaloop/sdk-scheme-adapter-api-svc",
3-
"version": "21.0.0-snapshot.57",
3+
"version": "21.0.0-snapshot.56",
44
"description": "An adapter for connecting to Mojaloop API enabled switches.",
55
"main": "src/index.js",
66
"types": "src/index.d.ts",
@@ -68,7 +68,7 @@
6868
"@mojaloop/central-services-error-handling": "13.1.0",
6969
"@mojaloop/central-services-logger": "11.9.1",
7070
"@mojaloop/central-services-metrics": "12.6.0",
71-
"@mojaloop/central-services-shared": "18.30.7",
71+
"@mojaloop/central-services-shared": "18.30.8",
7272
"@mojaloop/event-sdk": "14.6.1",
7373
"@mojaloop/logging-bc-client-lib": "0.5.8",
7474
"@mojaloop/ml-schema-transformer-lib": "2.7.7",
@@ -78,7 +78,7 @@
7878
"axios": "1.11.0",
7979
"body-parser": "2.2.0",
8080
"co-body": "6.2.0",
81-
"dotenv": "17.2.1",
81+
"dotenv": "17.2.2",
8282
"env-var": "7.5.0",
8383
"express": "4.21.2",
8484
"fast-json-patch": "3.1.1",
@@ -106,7 +106,7 @@
106106
"@redocly/openapi-cli": "1.0.0-beta.95",
107107
"@types/jest": "30.0.0",
108108
"axios-mock-adapter": "2.1.0",
109-
"babel-jest": "30.1.1",
109+
"babel-jest": "30.1.2",
110110
"eslint": "9.15.0",
111111
"eslint-config-airbnb-base": "15.0.0",
112112
"eslint-plugin-import": "2.32.0",

modules/api-svc/src/InboundServer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class InboundApi extends EventEmitter {
5252
super({ captureExceptions: true });
5353
this._conf = conf;
5454
this._cache = cache;
55-
this._metricsClient = metricsClient;
55+
this._logger = logger;
5656
_initialize ||= _validator.initialise(apiSpecs, conf);
5757

5858
if (conf.validateInboundJws) {

modules/api-svc/src/lib/model/InboundTransfersModel.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,17 @@ class InboundTransfersModel {
259259
}
260260
}
261261

262+
this.metrics.quoteRequests.inc();
263+
const endTimer = this.metrics.quoteRequestLatency.startTimer();
264+
this._quoteTimers.set(quoteRequest.quoteId, endTimer);
265+
262266
// make a call to the backend to ask for a quote response
263267
const response = await this._backendRequests.postQuoteRequests(internalForm);
264268

265269
if(!response) {
266270
// make an error callback to the source fsp
267-
return 'No response from backend'; }
271+
return 'No response from backend';
272+
}
268273

269274
if(!response.expiration) {
270275
const expiration = new Date().getTime() + (this._expirySeconds * 1000);
@@ -293,6 +298,11 @@ class InboundTransfersModel {
293298
if (headers.tracestate && headers.traceparent) {
294299
headers.tracestate += `,${TRACESTATE_KEY_CALLBACK_START_TS}=${Date.now()}`;
295300
}
301+
302+
this.metrics.quoteResponses.inc();
303+
const end = this._quoteTimers.get(quoteRequest.quoteId);
304+
if (end) { end(); this._quoteTimers.delete(quoteRequest.quoteId); }
305+
296306
const res = await this._mojaloopRequests.putQuotes(quoteRequest.quoteId, mojaloopResponse, sourceFspId, headers, { isoPostQuote: request.isoPostQuote });
297307

298308
this.data.quoteResponse = {
@@ -310,6 +320,11 @@ class InboundTransfersModel {
310320
const mojaloopError = await this._handleError(err);
311321
log.isInfoEnabled && log.push({ mojaloopError }).info(`Sending error response to ${sourceFspId}`);
312322
this.metrics.quoteGetResponseErrors.inc();
323+
324+
this.metrics.quoteResponses.inc();
325+
const end = this._quoteTimers.get(quoteRequest.quoteId);
326+
if (end) { end(); this._quoteTimers.delete(quoteRequest.quoteId); }
327+
313328
return this._mojaloopRequests.putQuotesError(quoteRequest.quoteId, mojaloopError, sourceFspId, headers);
314329
}
315330
}
@@ -596,6 +611,12 @@ class InboundTransfersModel {
596611
this._logger.isErrorEnabled && this._logger.push({ err, transferId }).error('Error in getTransfers');
597612
const mojaloopError = await this._handleError(err);
598613
this._logger.isInfoEnabled && this._logger.push({ mojaloopError }).info(`Sending error response to ${sourceFspId}`);
614+
615+
const end = this._transferTimers.get(transferId);
616+
if (end) {
617+
end(); // still stop latency timer, even for errors
618+
this._transferTimers.delete(transferId);
619+
}
599620
return this._mojaloopRequests.putTransfersError(transferId, mojaloopError, sourceFspId, headers);
600621
}
601622
}

modules/api-svc/src/lib/model/OutboundTransfersModel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ class OutboundTransfersModel {
14731473
log.isVerboseEnabled && log.verbose(`Transfer model state machine transition completed in state: ${this.stateMachine.state}. Recursing to handle next transition.`);
14741474
return this.run();
14751475
} catch (err) {
1476-
log.error('error running outbound transfer model: ', err);
1476+
log.isErrorEnabled && log.push({ err }).error(`error running outbound transfer model: ${err?.message}`);
14771477

14781478
// as this function is recursive, we dont want to error the state machine multiple times
14791479
if (this.data.currentState !== States.ERRORED) {

modules/outbound-command-event-handler/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
3-
"version": "0.3.0-snapshot.53",
3+
"version": "0.3.0-snapshot.52",
44
"description": "Mojaloop sdk scheme adapter command event handler",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -42,7 +42,7 @@
4242
},
4343
"dependencies": {
4444
"@mojaloop/api-snippets": "18.1.1",
45-
"@mojaloop/central-services-shared": "18.30.7",
45+
"@mojaloop/central-services-shared": "18.30.8",
4646
"@mojaloop/logging-bc-client-lib": "0.5.8",
4747
"@mojaloop/logging-bc-public-types-lib": "0.5.6",
4848
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
@@ -65,8 +65,8 @@
6565
"@types/supertest": "6.0.3",
6666
"@types/swagger-ui-express": "4.1.8",
6767
"@types/yamljs": "0.2.34",
68-
"@typescript-eslint/eslint-plugin": "8.41.0",
69-
"@typescript-eslint/parser": "8.41.0",
68+
"@typescript-eslint/eslint-plugin": "8.42.0",
69+
"@typescript-eslint/parser": "8.42.0",
7070
"copyfiles": "2.4.1",
7171
"eslint": "9.15.0",
7272
"jest": "29.7.0",

modules/outbound-domain-event-handler/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
3-
"version": "0.3.0-snapshot.53",
3+
"version": "0.3.0-snapshot.52",
44
"description": "mojaloop sdk scheme adapter outbound domain event handler",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -62,8 +62,8 @@
6262
"@types/supertest": "6.0.3",
6363
"@types/swagger-ui-express": "4.1.8",
6464
"@types/yamljs": "0.2.34",
65-
"@typescript-eslint/eslint-plugin": "8.41.0",
66-
"@typescript-eslint/parser": "8.41.0",
65+
"@typescript-eslint/eslint-plugin": "8.42.0",
66+
"@typescript-eslint/parser": "8.42.0",
6767
"copyfiles": "2.4.1",
6868
"eslint": "9.15.0",
6969
"jest": "29.7.0",

modules/private-shared-lib/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
3-
"version": "0.4.0-snapshot.53",
3+
"version": "0.4.0-snapshot.52",
44
"description": "SDK Scheme Adapter private shared library.",
55
"license": "Apache-2.0",
66
"homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
@@ -30,7 +30,7 @@
3030
},
3131
"dependencies": {
3232
"@mojaloop/api-snippets": "18.1.1",
33-
"@mojaloop/central-services-shared": "18.30.7",
33+
"@mojaloop/central-services-shared": "18.30.8",
3434
"@mojaloop/logging-bc-public-types-lib": "0.5.6",
3535
"@mojaloop/platform-shared-lib-messaging-types-lib": "0.7.3",
3636
"@mojaloop/platform-shared-lib-nodejs-kafka-client-lib": "0.5.18",
@@ -42,8 +42,8 @@
4242
"@eslint/compat": "1.3.2",
4343
"@types/node": "24.3.0",
4444
"@types/uuid": "10.0.0",
45-
"@typescript-eslint/eslint-plugin": "8.41.0",
46-
"@typescript-eslint/parser": "8.41.0",
45+
"@typescript-eslint/eslint-plugin": "8.42.0",
46+
"@typescript-eslint/parser": "8.42.0",
4747
"eslint": "9.15.0",
4848
"jest": "29.7.0",
4949
"npm-check-updates": "16.7.10",

0 commit comments

Comments
 (0)