account-lookup-service 15.6.0-iso.11 → 15.6.0-iso.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/handlers/monitoring/index.js +1 -1
- package/src/plugins.js +1 -1
- package/test/unit/api/health.test.js +3 -0
- package/src/handlers/monitoring/plugins/metrics.js +0 -48
- package/src/metrics/handler.js +0 -33
- package/src/metrics/plugin.js +0 -52
- package/src/metrics/routes.js +0 -43
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "account-lookup-service",
|
3
3
|
"description": "Account Lookup Service is used to validate Party and Participant lookups.",
|
4
|
-
"version": "15.6.0-iso.
|
4
|
+
"version": "15.6.0-iso.13",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -93,14 +93,14 @@
|
|
93
93
|
"@mojaloop/central-services-error-handling": "13.0.2",
|
94
94
|
"@mojaloop/central-services-health": "15.0.0",
|
95
95
|
"@mojaloop/central-services-logger": "11.5.1",
|
96
|
-
"@mojaloop/central-services-metrics": "12.1
|
96
|
+
"@mojaloop/central-services-metrics": "12.2.1",
|
97
97
|
"@mojaloop/central-services-shared": "18.11.2",
|
98
98
|
"@mojaloop/central-services-stream": "11.3.1",
|
99
99
|
"@mojaloop/database-lib": "11.0.6",
|
100
100
|
"@mojaloop/event-sdk": "14.1.1",
|
101
101
|
"@mojaloop/inter-scheme-proxy-cache-lib": "2.3.0",
|
102
102
|
"@mojaloop/ml-schema-transformer-lib": "2.4.1",
|
103
|
-
"@mojaloop/sdk-standard-components": "19.5.
|
103
|
+
"@mojaloop/sdk-standard-components": "19.5.2",
|
104
104
|
"@now-ims/hapi-now-auth": "2.1.0",
|
105
105
|
"ajv": "8.17.1",
|
106
106
|
"ajv-keywords": "5.1.0",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
const Hapi = require('@hapi/hapi')
|
19
19
|
const Metrics = require('@mojaloop/central-services-metrics')
|
20
20
|
const { plugin: HealthPlugin } = require('./plugins/health')
|
21
|
-
const
|
21
|
+
const MetricsPlugin = require('@mojaloop/central-services-metrics').plugin
|
22
22
|
const { logger } = require('../../lib')
|
23
23
|
|
24
24
|
let server
|
package/src/plugins.js
CHANGED
@@ -38,7 +38,7 @@ const {
|
|
38
38
|
} = require('@mojaloop/central-services-shared').Util.Hapi
|
39
39
|
|
40
40
|
const Config = require('./lib/config')
|
41
|
-
const MetricsPlugin = require('
|
41
|
+
const MetricsPlugin = require('@mojaloop/central-services-metrics').plugin
|
42
42
|
const RequestLogger = require('./lib/requestLogger')
|
43
43
|
|
44
44
|
const registerPlugins = async (server, openAPIBackend) => {
|
@@ -38,6 +38,7 @@ const Sinon = require('sinon')
|
|
38
38
|
const MigrationLockModel = require('../../../src/models/misc/migrationLock')
|
39
39
|
const Logger = require('@mojaloop/central-services-logger')
|
40
40
|
const Config = require('../../../src/lib/config')
|
41
|
+
const Metrics = require('@mojaloop/central-services-metrics')
|
41
42
|
|
42
43
|
Logger.isDebugEnabled = jest.fn(() => true)
|
43
44
|
Logger.isErrorEnabled = jest.fn(() => true)
|
@@ -51,6 +52,7 @@ describe('/health', () => {
|
|
51
52
|
sandbox = Sinon.createSandbox()
|
52
53
|
sandbox.stub(Db, 'connect').returns(Promise.resolve({}))
|
53
54
|
Config.API_PORT = await getPort()
|
55
|
+
Metrics.getDefaultRegister().clear()
|
54
56
|
server = await initServer(Config)
|
55
57
|
})
|
56
58
|
|
@@ -117,6 +119,7 @@ describe('/health', () => {
|
|
117
119
|
Config.proxyMap = { proxied: 'proxy' }
|
118
120
|
let serverWithProxy
|
119
121
|
try {
|
122
|
+
Metrics.getDefaultRegister().clear()
|
120
123
|
serverWithProxy = await initServer(Config)
|
121
124
|
sandbox.stub(MigrationLockModel, 'getIsMigrationLocked').resolves(false)
|
122
125
|
const mock = await Helper.generateMockRequest('/health', 'get')
|
@@ -1,48 +0,0 @@
|
|
1
|
-
/*****
|
2
|
-
LICENSE
|
3
|
-
|
4
|
-
Copyright © 2020 Mojaloop Foundation
|
5
|
-
|
6
|
-
The Mojaloop files are made available by the Mojaloop Foundation under the Apache License, Version 2.0
|
7
|
-
(the "License") and you may not use these files except in compliance with the [License](http://www.apache.org/licenses/LICENSE-2.0).
|
8
|
-
|
9
|
-
You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
10
|
-
|
11
|
-
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
12
|
-
either express or implied. See the License for the specific language governing permissions and limitations under the [License](http://www.apache.org/licenses/LICENSE-2.0).
|
13
|
-
|
14
|
-
* Infitx
|
15
|
-
- Steven Oderayi <steven.oderayi@infitx.com>
|
16
|
-
--------------
|
17
|
-
******/
|
18
|
-
|
19
|
-
'use strict'
|
20
|
-
|
21
|
-
const HTTPENUM = require('@mojaloop/central-services-shared').Enum.Http
|
22
|
-
const Metrics = require('@mojaloop/central-services-metrics')
|
23
|
-
|
24
|
-
const handler = {
|
25
|
-
get: async (_request, reply) => {
|
26
|
-
return reply.response(await Metrics.getMetricsForPrometheus()).code(HTTPENUM.ReturnCodes.OK.CODE)
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
const routes = [
|
31
|
-
{
|
32
|
-
method: 'GET',
|
33
|
-
path: '/metrics',
|
34
|
-
handler: handler.get
|
35
|
-
}
|
36
|
-
]
|
37
|
-
|
38
|
-
const plugin = {
|
39
|
-
name: 'Metrics',
|
40
|
-
register (server) {
|
41
|
-
server.route(routes)
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
module.exports = {
|
46
|
-
plugin,
|
47
|
-
handler
|
48
|
-
}
|
package/src/metrics/handler.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
/*****
|
2
|
-
License
|
3
|
-
--------------
|
4
|
-
Copyright © 2017 Bill & Melinda Gates Foundation
|
5
|
-
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
7
|
-
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
8
|
-
Contributors
|
9
|
-
--------------
|
10
|
-
This is the official list of the Mojaloop project contributors for this file.
|
11
|
-
Names of the original copyright holders (individuals or organizations)
|
12
|
-
should be listed with a '*' in the first column. People who have
|
13
|
-
contributed from an organization can be listed under the organization
|
14
|
-
that actually holds the copyright for their contributions (see the
|
15
|
-
Gates Foundation organization for an example). Those individuals should have
|
16
|
-
their names indented and be marked with a '-'. Email address can be added
|
17
|
-
optionally within square brackets <email>.
|
18
|
-
* Gates Foundation
|
19
|
-
- Name Surname <name.surname@gatesfoundation.com>
|
20
|
-
|
21
|
-
- Pedro Barreto <pedrob@crosslaketech.com>
|
22
|
-
- Rajiv Mothilal <rajivmothilal@gmail.com>
|
23
|
-
- Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
24
|
-
--------------
|
25
|
-
******/
|
26
|
-
|
27
|
-
'use strict'
|
28
|
-
|
29
|
-
const Metrics = require('@mojaloop/central-services-metrics')
|
30
|
-
|
31
|
-
exports.metrics = async function (request, h) {
|
32
|
-
return h.response(await Metrics.getMetricsForPrometheus()).code(200)
|
33
|
-
}
|
package/src/metrics/plugin.js
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
/*****
|
2
|
-
License
|
3
|
-
--------------
|
4
|
-
Copyright © 2017 Bill & Melinda Gates Foundation
|
5
|
-
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
6
|
-
|
7
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
|
9
|
-
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
10
|
-
|
11
|
-
Contributors
|
12
|
-
--------------
|
13
|
-
This is the official list of the Mojaloop project contributors for this file.
|
14
|
-
Names of the original copyright holders (individuals or organizations)
|
15
|
-
should be listed with a '*' in the first column. People who have
|
16
|
-
contributed from an organization can be listed under the organization
|
17
|
-
that actually holds the copyright for their contributions (see the
|
18
|
-
Gates Foundation organization for an example). Those individuals should have
|
19
|
-
their names indented and be marked with a '-'. Email address can be added
|
20
|
-
optionally within square brackets <email>.
|
21
|
-
|
22
|
-
* Gates Foundation
|
23
|
-
- Name Surname <name.surname@gatesfoundation.com>
|
24
|
-
|
25
|
-
* Lazola Lucas <lazola.lucas@modusbox.com>
|
26
|
-
* Rajiv Mothilal <rajiv.mothilal@modusbox.com>
|
27
|
-
* Miguel de Barros <miguel.debarros@modusbox.com>
|
28
|
-
* Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
29
|
-
|
30
|
-
--------------
|
31
|
-
|
32
|
-
******/
|
33
|
-
'use strict'
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @module src/metrics/plugin
|
37
|
-
*/
|
38
|
-
|
39
|
-
/**
|
40
|
-
* @function Register Handler Routes HAPI
|
41
|
-
*
|
42
|
-
* @async
|
43
|
-
* @description Registers registers plugins on HAPI server. This retrieves all routes to be exposed from the routes.js file
|
44
|
-
* @returns {Promise} - Returns a promise: resolve if successful, or rejection if failed
|
45
|
-
*/
|
46
|
-
|
47
|
-
exports.plugin = {
|
48
|
-
name: 'handler metrics routes',
|
49
|
-
register: function (server) {
|
50
|
-
server.route(require('./routes'))
|
51
|
-
}
|
52
|
-
}
|
package/src/metrics/routes.js
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
/*****
|
2
|
-
License
|
3
|
-
--------------
|
4
|
-
Copyright © 2017 Bill & Melinda Gates Foundation
|
5
|
-
The Mojaloop files are made available by the Bill & Melinda Gates Foundation under the Apache License, Version 2.0 (the "License") and you may not use these files except in compliance with the License. You may obtain a copy of the License at
|
6
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
7
|
-
Unless required by applicable law or agreed to in writing, the Mojaloop files are distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
8
|
-
Contributors
|
9
|
-
--------------
|
10
|
-
This is the official list of the Mojaloop project contributors for this file.
|
11
|
-
Names of the original copyright holders (individuals or organizations)
|
12
|
-
should be listed with a '*' in the first column. People who have
|
13
|
-
contributed from an organization can be listed under the organization
|
14
|
-
that actually holds the copyright for their contributions (see the
|
15
|
-
Gates Foundation organization for an example). Those individuals should have
|
16
|
-
their names indented and be marked with a '-'. Email address can be added
|
17
|
-
optionally within square brackets <email>.
|
18
|
-
* Gates Foundation
|
19
|
-
- Name Surname <name.surname@gatesfoundation.com>
|
20
|
-
|
21
|
-
- Pedro Barreto <pedrob@crosslaketech.com>
|
22
|
-
- Rajiv Mothilal <rajivmothilal@gmail.com>
|
23
|
-
- Shashikant Hirugade <shashikant.hirugade@modusbox.com>
|
24
|
-
--------------
|
25
|
-
******/
|
26
|
-
|
27
|
-
'use strict'
|
28
|
-
|
29
|
-
const Handler = require('./handler')
|
30
|
-
const tags = ['api', 'metrics']
|
31
|
-
|
32
|
-
module.exports = [
|
33
|
-
{
|
34
|
-
method: 'GET',
|
35
|
-
path: '/metrics',
|
36
|
-
handler: Handler.metrics,
|
37
|
-
config: {
|
38
|
-
tags,
|
39
|
-
description: 'Prometheus metrics endpoint',
|
40
|
-
id: 'metrics'
|
41
|
-
}
|
42
|
-
}
|
43
|
-
]
|