summaryrefslogtreecommitdiffstats
path: root/k6-tests/ncmp/common/search-base.js
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2024-08-30 16:25:04 +0100
committerSourabh Sourabh <sourabh.sourabh@est.tech>2024-09-10 09:07:17 +0000
commit175d12da41b1257fe3be5b3e95540e99c8952f82 (patch)
treefce9bc5589eb88e3b1c4bcaf7366324f5bf13f84 /k6-tests/ncmp/common/search-base.js
parent8b3258f21f9957f356bed6cb222361ec09cefd04 (diff)
Fix high-cardinality metrics in k6, causing high memory use
- Added unique IDs as metric tags for all the endpoints. - Re-arranged order of public and prive js methods. Issue-ID: CPS-2331 Change-Id: Ib876a647fb35110c50670c7222986e8a8a6f5ca0 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'k6-tests/ncmp/common/search-base.js')
-rw-r--r--k6-tests/ncmp/common/search-base.js34
1 files changed, 16 insertions, 18 deletions
diff --git a/k6-tests/ncmp/common/search-base.js b/k6-tests/ncmp/common/search-base.js
index beb3aad07c..a6424fe5d0 100644
--- a/k6-tests/ncmp/common/search-base.js
+++ b/k6-tests/ncmp/common/search-base.js
@@ -18,8 +18,22 @@
* ============LICENSE_END=========================================================
*/
-import http from 'k6/http';
-import { NCMP_BASE_URL, CONTENT_TYPE_JSON_PARAM } from './utils.js';
+import {performPostRequest, NCMP_BASE_URL} from './utils.js';
+
+export function executeCmHandleSearch(scenario) {
+ return executeSearchRequest('searches', scenario);
+}
+
+export function executeCmHandleIdSearch(scenario) {
+ return executeSearchRequest('id-searches', scenario);
+}
+
+function executeSearchRequest(searchType, scenario) {
+ const searchParameters = SEARCH_PARAMETERS_PER_SCENARIO[scenario];
+ const payload = JSON.stringify(searchParameters);
+ const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${searchType}`;
+ return performPostRequest(url, payload, searchType);
+}
const SEARCH_PARAMETERS_PER_SCENARIO = {
"module-and-properties": {
@@ -43,19 +57,3 @@ const SEARCH_PARAMETERS_PER_SCENARIO = {
]
}
};
-
-export function executeCmHandleSearch(scenario) {
- return executeSearchRequest('searches', scenario);
-}
-
-export function executeCmHandleIdSearch(scenario) {
- return executeSearchRequest('id-searches', scenario);
-}
-
-function executeSearchRequest(searchType, scenario) {
- const searchParameters = SEARCH_PARAMETERS_PER_SCENARIO[scenario];
- const payload = JSON.stringify(searchParameters);
- const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${searchType}`;
- const response = http.post(url, payload, CONTENT_TYPE_JSON_PARAM);
- return response;
-}