diff --git a/probe/.env b/probe/.env index 53c26c027f..a73c91899d 100644 --- a/probe/.env +++ b/probe/.env @@ -2,4 +2,6 @@ CLUSTER_KEY=f414c23b4cdf4e84a6a66ecfd528eff2 PROBE_NAME=US PROBE_KEY=33b674ca-9fdd-11e9-a2a3-2a2ae2dbccez SERVER_URL=http://localhost:3002 -DATA_INGESTOR_URL=http://localhost:3200 \ No newline at end of file +DATA_INGESTOR_URL=http://localhost:3200 +RESOURCES_LIMIT=10 +FETCH_RESOURCES_URL=http://localhost:3400 \ No newline at end of file diff --git a/probe/utils/api.js b/probe/utils/api.js index a63c4d545c..59fa237e1a 100755 --- a/probe/utils/api.js +++ b/probe/utils/api.js @@ -41,12 +41,12 @@ const _this = { }); }, - getApi: url => { + getApi: (url, limit = 10) => { const headers = _this.getHeaders(); return new Promise((resolve, reject) => { axios({ method: 'GET', - url: `${config.dataIngestorUrl}/${url}`, + url: `${config.fetchResourcesUrl}/${url}?limit=${limit}`, headers, }) .then(function(response) { diff --git a/probe/utils/config.js b/probe/utils/config.js index b7e173a47c..0a0c2d17b4 100755 --- a/probe/utils/config.js +++ b/probe/utils/config.js @@ -44,4 +44,5 @@ module.exports = { clusterKey: process.env['CLUSTER_KEY'], probeVersion: packageJson.version, dataIngestorUrl: process.env['DATA_INGESTOR_URL'], + fetchResourcesUrl: process.env['FETCH_RESOURCES_URL'], }; diff --git a/probe/workers/main.js b/probe/workers/main.js index 22ced8951a..c81f8f08f1 100755 --- a/probe/workers/main.js +++ b/probe/workers/main.js @@ -11,6 +11,7 @@ const ServerMonitors = require('./serverMonitors'); const ErrorService = require('../utils/errorService'); const IncomingHttpRequestMonitors = require('./incomingHttpRequestMonitors'); const KubernetesMonitors = require('./kubernetesMonitors'); +const limit = process.env.RESOURCES_LIMIT; // const ApiService = require('../utils/apiService'); /** @@ -28,7 +29,7 @@ const KubernetesMonitors = require('./kubernetesMonitors'); module.exports = { runJob: async function(monitorStore) { try { - let monitors = await getApi('probe/monitors'); + let monitors = await getApi('probe/monitors', limit); monitors = JSON.parse(monitors.data); // parse the stringified data // add monitor to store