danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ============LICENSE_START======================================================= |
| 3 | * Copyright (C) 2024 Nordix Foundation |
| 4 | * ================================================================================ |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | * |
| 17 | * SPDX-License-Identifier: Apache-2.0 |
| 18 | * ============LICENSE_END========================================================= |
| 19 | */ |
| 20 | |
| 21 | export const NCMP_BASE_URL = 'http://localhost:8883'; |
| 22 | export const DMI_PLUGIN_URL = 'http://ncmp-dmi-plugin-demo-and-csit-stub:8092'; |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 23 | export const TOTAL_CM_HANDLES = 20000; |
| 24 | export const REGISTRATION_BATCH_SIZE = 100; |
danielhanrahan | dbe7b66 | 2024-07-16 11:47:24 +0100 | [diff] [blame] | 25 | export const READ_DATA_FOR_CM_HANDLE_DELAY_MS = 300; // must have same value as in docker-compose.yml |
| 26 | export const WRITE_DATA_FOR_CM_HANDLE_DELAY_MS = 670; // must have same value as in docker-compose.yml |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 27 | export const CONTENT_TYPE_JSON_PARAM = { headers: {'Content-Type': 'application/json'} }; |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 28 | export const DATA_OPERATION_READ_BATCH_SIZE = 200; |
| 29 | export const TOPIC_DATA_OPERATIONS_BATCH_READ = 'topic-data-operations-batch-read'; |
| 30 | export const KAFKA_BOOTSTRAP_SERVERS = ['localhost:9092']; |
emaclee | f11aad9 | 2024-08-14 14:25:33 +0100 | [diff] [blame] | 31 | export const MODULE_SET_TAGS = ['tagA','tagB','tagC',' tagD'] |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 32 | |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 33 | |
danielhanrahan | f66694a | 2024-06-10 21:32:12 +0100 | [diff] [blame] | 34 | /** |
| 35 | * Generates a batch of CM-handle IDs based on batch size and number. |
| 36 | * @param {number} batchSize - Size of each batch. |
| 37 | * @param {number} batchNumber - Number of the batch. |
| 38 | * @returns {string[]} Array of CM-handle IDs, for example ['ch-201', 'ch-202' ... 'ch-300'] |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 39 | */ |
| 40 | export function makeBatchOfCmHandleIds(batchSize, batchNumber) { |
| 41 | const batchOfIds = []; |
| 42 | const startIndex = 1 + batchNumber * batchSize; |
| 43 | for (let i = 0; i < batchSize; i++) { |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 44 | let cmHandleId = `ch-${startIndex + i}`; |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 45 | batchOfIds.push(cmHandleId); |
| 46 | } |
| 47 | return batchOfIds; |
| 48 | } |
| 49 | |
| 50 | export function getRandomCmHandleId() { |
danielhanrahan | f66694a | 2024-06-10 21:32:12 +0100 | [diff] [blame] | 51 | return `ch-${Math.floor(Math.random() * TOTAL_CM_HANDLES) + 1}`; |
danielhanrahan | c0b6f3a | 2024-04-29 16:16:42 +0100 | [diff] [blame] | 52 | } |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 53 | |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 54 | export function makeCustomSummaryReport(data, options) { |
danielhanrahan | dbe7b66 | 2024-07-16 11:47:24 +0100 | [diff] [blame] | 55 | const summaryCsvLines = [ |
| 56 | '#,Test Name,Unit,Limit,Actual', |
| 57 | makeSummaryCsvLine('1', 'Registration of CM-handles', 'CM-handles/second', 'cmhandles_created_per_second', data, options), |
| 58 | makeSummaryCsvLine('2', 'De-registration of CM-handles', 'CM-handles/second', 'cmhandles_deleted_per_second', data, options), |
| 59 | makeSummaryCsvLine('3', 'CM-handle ID search with Module filter', 'milliseconds', 'http_req_duration{scenario:id_search_module}', data, options), |
| 60 | makeSummaryCsvLine('4', 'CM-handle search with Module filter', 'milliseconds', 'http_req_duration{scenario:cm_search_module}', data, options), |
danielhanrahan | a1cdf73 | 2024-08-16 11:09:25 +0100 | [diff] [blame] | 61 | makeSummaryCsvLine('5a', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', data, options), |
| 62 | makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_read_alt_id', data, options), |
| 63 | makeSummaryCsvLine('6', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', data, options), |
halil.cakal | 65b870b | 2024-07-25 11:12:29 +0100 | [diff] [blame] | 64 | makeSummaryCsvLine('7', 'Data operations batch read', 'events/second', 'data_operations_batch_read_cmhandles_per_second', data, options), |
halil.cakal | 1745d20 | 2024-08-06 14:02:49 +0100 | [diff] [blame^] | 65 | makeSummaryCsvLine('1x', 'Failures of Registration of CM-handles', 'number of failed requests', 'http_req_failed{group:::setup}', data, options), |
| 66 | makeSummaryCsvLine('2x', 'Failures of De-registration of CM-handles', 'number of failed requests', 'http_req_failed{group:::teardown}', data, options), |
| 67 | makeSummaryCsvLine('3x', 'Failures of CM-handle ID search with Module filter', 'number of failed requests', 'http_req_failed{scenario:id_search_module}', data, options), |
| 68 | makeSummaryCsvLine('4x', 'Failures of CM-handle search with Module filter', 'number of failed requests', 'http_req_failed{scenario:cm_search_module}', data, options), |
| 69 | makeSummaryCsvLine('5x', 'Failures of Synchronous single CM-handle pass-through read', 'number of failed requests', 'http_req_failed{scenario:passthrough_read}', data, options), |
| 70 | makeSummaryCsvLine('6x', 'Failures of Synchronous single CM-handle pass-through write', 'number of failed requests', 'http_req_failed{scenario:passthrough_write}', data, options), |
| 71 | makeSummaryCsvLine('7ax', 'Failures of Data operations batch read', 'number of failed requests', 'http_req_failed{scenario:data_operation_send_async_http_request}', data, options), |
| 72 | makeSummaryCsvLine('7bx', 'Failures of Data operations batch read consume kafka responses', 'number of failed requests', 'kafka_reader_error_count{scenario:data_operation_consume_kafka_responses}', data, options), |
danielhanrahan | dbe7b66 | 2024-07-16 11:47:24 +0100 | [diff] [blame] | 73 | ]; |
| 74 | return summaryCsvLines.join('\n') + '\n'; |
halil.cakal | 0613fbd | 2024-05-27 16:06:59 +0100 | [diff] [blame] | 75 | } |
| 76 | |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 77 | function makeSummaryCsvLine(testCase, testName, unit, thresholdInK6, data, options) { |
| 78 | const thresholdArray = JSON.parse(JSON.stringify(options.thresholds[thresholdInK6])); |
| 79 | const thresholdString = thresholdArray[0]; |
| 80 | const [thresholdKey, thresholdOperator, thresholdValue] = thresholdString.split(/\s+/); |
| 81 | const actualValue = data.metrics[thresholdInK6].values[thresholdKey].toFixed(3); |
danielhanrahan | dbe7b66 | 2024-07-16 11:47:24 +0100 | [diff] [blame] | 82 | return `${testCase},${testName},${unit},${thresholdValue},${actualValue}`; |
danielhanrahan | 4e9f68c | 2024-06-28 13:43:35 +0100 | [diff] [blame] | 83 | } |