diff --git a/README.md b/README.md index 388f6f6..d7c87d7 100644 --- a/README.md +++ b/README.md @@ -298,10 +298,12 @@ import io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager; String sRegexTc = ".*"; String sFileIn = "script1.jmx"; String sFileOut = "script1_add.jmx"; -ElasticApmJMeterManager.modifyAddSamplerForelasticApm(sFileIn, sFileOut, ElasticApmJMeterManager.ACTION_ADD, sRegexTc, ElasticApmJMeterManager.EXTRACT_START_JSR223, ElasticApmJMeterManager.EXTRACT_END_JSR223, ElasticApmJMeterManager.EXTRACT_UDV_elastic); +ElasticApmJMeterManager.modifyAddSamplerForElasticApm(sFileIn, sFileOut, ElasticApmJMeterManager.ACTION_ADD, sRegexTc, ElasticApmJMeterManager.EXTRACT_START_JSR223, ElasticApmJMeterManager.EXTRACT_END_JSR223, ElasticApmJMeterManager.EXTRACT_UDV_ELASTIC); ## Version +Version 1.3 change method name ELK to ELASTIC et file name tp extract_udv_elastic_under_testplan.jmx + Version 1.2 change globally ELK to ELASTIC Version 1.1 correct the class name in the uber jar and correct REMOVE result diff --git a/pom.xml b/pom.xml index 9ea1691..c2faeee 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.vdaburon jmeter-elastic-apm - 1.2 + 1.3 jar Manage ELASTIC APM integration for Apache JMeter ADD/REMOVE ELASTIC APM library api call around Transaction Controller, you will see timeline and sub calls for the Transaction Controller (Page) in Kibana diff --git a/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java b/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java index 4cd5163..c755a22 100644 --- a/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java +++ b/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java @@ -55,7 +55,7 @@ public class ElasticApmJMeterManager { // this files are in the jar public static final String EXTRACT_START_JSR223 = "extract_start_transaction_ignore_jsr223.xml"; public static final String EXTRACT_END_JSR223 = "extract_end_transaction_ignore_jsr223.xml"; - public static final String EXTRACT_UDV_ELK = "extract_udv_elk_under_testplan.xml"; + public static final String EXTRACT_UDV_ELASTIC = "extract_udv_elastic_under_testplan.xml"; public static void main(String[] args) { long startTime = System.currentTimeMillis(); @@ -114,7 +114,7 @@ public static void main(String[] args) { // XML extract to add jsr223 in the new file String sExtractAddStartJsr = EXTRACT_START_JSR223; String sExtractAddEndJsr = EXTRACT_END_JSR223; - String sExtractUdvUnderTp = EXTRACT_UDV_ELK; + String sExtractUdvUnderTp = EXTRACT_UDV_ELASTIC; sTmp = (String) parseProperties.get(K_EXTRACT_START_OPT); if (sTmp != null) { @@ -134,7 +134,7 @@ public static void main(String[] args) { LOGGER.info(K_EXTRACT_UDV_OPT + "=" + sExtractUdvUnderTp); } - modifyAddSamplerForElkApm(sJMeterXmlFileScript, sJMeterXmlFileScriptOutModif, action, regex, sExtractAddStartJsr, sExtractAddEndJsr, sExtractUdvUnderTp); + modifyAddSamplerForElasticApm(sJMeterXmlFileScript, sJMeterXmlFileScriptOutModif, action, regex, sExtractAddStartJsr, sExtractAddEndJsr, sExtractUdvUnderTp); long durationMs = System.currentTimeMillis() - startTime; LOGGER.info("Duration milli seconds=" + durationMs); @@ -142,7 +142,7 @@ public static void main(String[] args) { System.exit(0); } - public static void modifyAddSamplerForElkApm(String jmeterXmlScript, String sJMeterXmlFileScriptModif, String action, String sRegexTcLabel, String sExtractAddStartJsr, String sExtractAddEndJsr, String sExtractUdvUnderTp) { + public static void modifyAddSamplerForElasticApm(String jmeterXmlScript, String sJMeterXmlFileScriptModif, String action, String sRegexTcLabel, String sExtractAddStartJsr, String sExtractAddEndJsr, String sExtractUdvUnderTp) { LinkedList lkFileJMeterOrig = readFileToLinkedList(jmeterXmlScript, READ_DIRECT_FILE); int readMode = READ_FROM_JAR; @@ -162,7 +162,7 @@ public static void modifyAddSamplerForElkApm(String jmeterXmlScript, String sJMe } LinkedList lkEnd = readFileToLinkedList(sExtractAddEndJsr, readMode); - if (EXTRACT_UDV_ELK.equals(sExtractUdvUnderTp)) { + if (EXTRACT_UDV_ELASTIC.equals(sExtractUdvUnderTp)) { readMode = READ_FROM_JAR; } else { @@ -172,16 +172,16 @@ public static void modifyAddSamplerForElkApm(String jmeterXmlScript, String sJMe LinkedList fileModified = null; if (ACTION_ADD.equals(action)) { - fileModified = addSamplerForElkApm(lkFileJMeterOrig, sRegexTcLabel, lkStart, lkEnd, lkUdvUnderTp); + fileModified = addSamplerForElasticApm(lkFileJMeterOrig, sRegexTcLabel, lkStart, lkEnd, lkUdvUnderTp); } if (ACTION_REMOVE.equals(action)) { - fileModified = removeSamplerForElkApm(lkFileJMeterOrig, sRegexTcLabel, lkStart, lkEnd, lkUdvUnderTp); + fileModified = removeSamplerForElasticApm(lkFileJMeterOrig, sRegexTcLabel, lkStart, lkEnd, lkUdvUnderTp); } writeXml(fileModified, sJMeterXmlFileScriptModif); } - private static LinkedList addSamplerForElkApm(LinkedList lkfileJMeterOrig, String regexTc, LinkedList lkStart, LinkedList lkEnd, LinkedList lkUdvUnderTp) { + private static LinkedList addSamplerForElasticApm(LinkedList lkfileJMeterOrig, String regexTc, LinkedList lkStart, LinkedList lkEnd, LinkedList lkUdvUnderTp) { LinkedList lkReturn = new LinkedList(); Pattern patternStartEltTc = Pattern.compile(".*?"); @@ -275,14 +275,14 @@ private static LinkedList addSamplerForElkApm(LinkedList lkfileJ return lkReturn; } - private static LinkedList removeSamplerForElkApm(LinkedList lkfileJMeterOrig, String regexTc, LinkedList lkStart, LinkedList lkEnd, LinkedList lkUdvUnderTp) { + private static LinkedList removeSamplerForElasticApm(LinkedList lkfileJMeterOrig, String regexTc, LinkedList lkStart, LinkedList lkEnd, LinkedList lkUdvUnderTp) { LinkedList lkReturn = new LinkedList(); Pattern patternCommentStartEltTc = Pattern.compile(".*?" + COMMENT_BEGIN_ELASTIC_APM + ""); // JSR223 for begin transaction Pattern patternStartEltJsr223 = Pattern.compile(".*?" + COMMENT_END_ELASTIC_APM + ""); // JSR223 for end transaction - Pattern patternCommentEltArgument = Pattern.compile(".*?" + COMMENT_APM_UDV + ""); // UDV with ELK_APM_UDV + Pattern patternCommentEltArgument = Pattern.compile(".*?" + COMMENT_APM_UDV + ""); // UDV with ELASTIC_APM_UDV Pattern patternStartEltArguments = Pattern.compile(".*? removeSamplerForElkApm(LinkedList lkfi Matcher matcherCommentEndEltTc = patternCommentEndEltTc.matcher(currentLine); boolean isCommentEndEltTc = matcherCommentEndEltTc.matches(); // - if (isCommentStartEltTc || isCommentEndEltTc) { // @@ELK_APM_BEGIN or @@ELK_APM_END - // remove lines in the lkReturn from comment @@ELK_APM_BEGIN to removeSamplerForElkApm(LinkedList lkfi bAlreadyAdd = true; } - // @@ELK_APM_UDV + // @@ELASTIC_APM_UDV Matcher matcherCommentEltArgument = patternCommentEltArgument.matcher(currentLine); boolean isCommentEltArgument = matcherCommentEltArgument.matches(); if (isCommentEltArgument) { - // remove lines in the lkReturn from comment @@ELK_APM_UDV to