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>
diff --git a/k6-tests/ncmp/common/search-base.js b/k6-tests/ncmp/common/search-base.js
index beb3aad..a6424fe 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 @@
]
}
};
-
-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;
-}