diff --git a/README.md b/README.md index ac9c155..388f6f6 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@

-jmeter-elk-apm logo +jmeter-elastic-apm logo

Manages the integration of ElasticSearch Application Performance Monitoring API in the Apache JMeter.

-

Link to github project jmeter-elk-apm

+

Link to github project jmeter-elastic-apm

# Apache JMeter with integration of ElasticSearch Application Performance Monitoring @@ -13,7 +13,7 @@ The main goal is to show the timeline of pages declared in JMeter script in the This tool adds JSR223 groovy sampler to create a new APM Transaction before a JMeter Transaction Controller and adds JSR223 groovy sampler to end the transaction after the JMeter Transaction Controller -This tool **adds** also User Defined Variables for ELK APM configuration +This tool **adds** also User Defined Variables for elastic APM configuration This tool could **remove** all JSR223 groovy that contains api calls to return to the initial JMeter script. @@ -24,7 +24,7 @@ A simple JMeter script with 3 Transaction Controller corresponding to 3 differen Launch the tool to modify the script : script1.jmx
-java -jar jmeter-elk-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx -action ADD -regex SC.*
+java -jar jmeter-elastic-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx -action ADD -regex SC.*
 
and the script (script1_add.jmx) after **action** = **ADD** @@ -42,7 +42,7 @@ And in the "groovy end transaction apm", the groovy code calls the ElasticApmp A transaction.end(); -![Script with ELK APM configuration and groovy code](doc/images/script_add.png) +![Script with elastic APM configuration and groovy code](doc/images/script_add.png) In View Results Tree, you will see new request headers (traceparent and elastic-apm-traceparent) automatically added by the elastic apm agent with the transaction id (e.g: 4443e451a1f7d42abdfbd739d455eac5) created by the jsr223 groovy begin transaction apm. @@ -59,21 +59,21 @@ And the TIMELINE for JMeter Transaction Controller, you see the JMeter Page and ## Simplified architecture diagram The simplified architecture : Apache JMeter and a java apm agent, Apache Tomcat and the java apm agent with web application gestdoc, ElasticSearch suite with ElasticSearch, APM Server and Kibana, a user views the Kibana Dashboards with navigator. -![simplified architecture](doc/images/architecture_jmeter_tomcat_elk.png) +![simplified architecture](doc/images/architecture_jmeter_tomcat_elastic_apm.png) ## License See the LICENSE file Apache 2 [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0) ## Ready to use -In the [Release of the project](https://github.com/vdaburon/jmeter-elk-apm/releases) you will find the tool compiled in one (uber) jar file which is directly usable. +In the [Release of the project](https://github.com/vdaburon/jmeter-elastic-apm/releases) you will find the tool compiled in one (uber) jar file which is directly usable. ## Help
-[main] INFO io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager - main begin
-usage: io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager -action <action> [-extract_end <extract_end>]
+[main] INFO io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager - main begin
+usage: io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager -action <action> [-extract_end <extract_end>]
        [-extract_start <extract_start>] [-extract_udv <extract_udv>] -file_in <file_in> -file_out <file_out> [-help]
        [-regex <regex>]
-io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager
+io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager
  -action <action>                 action ADD or REMOVE, ADD : add groovy api call and REMOVE : remove groovy api call
  -extract_end <extract_end>       optional, file contains groovy end call api (e.g : extract_end.xml), default read file
                                   in the jar
@@ -86,11 +86,11 @@ io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager
  -help                            Help and show parameters
  -regex <regex>                   regular expression matches Transaction Controller Label (default .*) (e.g : SC[0-9]+_.
                                   for SC01_P01_HOME or SC09_P12_LOGOUT)
-E.g : java -jar jmeter-elk-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx
+E.g : java -jar jmeter-elastic-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx
 -action ADD -regex SC.*
-E.g : java -jar jmeter-elk-apm-<version>-jar-with-dependencies.jar -file_in script1_add.jmx -file_out
+E.g : java -jar jmeter-elastic-apm-<version>-jar-with-dependencies.jar -file_in script1_add.jmx -file_out
 script1_remove.jmx -action REMOVE -regex .*
-[main] INFO io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager - main end (exit 1) ERROR
+[main] INFO io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager - main end (exit 1) ERROR
 
 
@@ -98,11 +98,11 @@ script1_remove.jmx -action REMOVE -regex .* This tool add "User Defined Variables" with default value -![User Defined Variables for ELK APM](doc/images/udv_elkp_properties.png) +![User Defined Variables for elastic APM](doc/images/udv_elastic_properties.png) This variables could be changed with JMeter properties at launch time, this properties could be set with -J<property> -ELK APM properties are : +elastic APM properties are : | property name | comment | |------------------|--------------------------------------------------------------------------------------------------| @@ -116,17 +116,17 @@ The main limitation of this tool is only one Transaction Controller level. You c You can manually remove the groovy code before the parent Transaction Controller or give the regular expression for only children Transaction Controller. -## Start Apache JMeter with ELK APM agent and ELK APM api library +## Start Apache JMeter with ELASTIC APM agent and ELASTIC APM api library -### Declare the elastic apm agent +### Declare the ELASTIC APM Agent Url to find the apm agent : [https://mvnrepository.com/artifact/co.elastic.apm/elastic-apm-agent](https://mvnrepository.com/artifact/co.elastic.apm/elastic-apm-agent) -Add the ELK apm agent somewhere in the filesystem (could be in the <JMETER_HOME>\lib but not mandatory) +Add the ELASTIC APM Agent somewhere in the filesystem (could be in the <JMETER_HOME>\lib but not mandatory) In <JMETER_HOME>\bin modify the jmeter.bat or setenv.bat -Add ELK APM configuration likes : +Add ELASTIC APM configuration likes :
 set APM_SERVICE_NAME=yourServiceName
 set APM_ENVIRONMENT=yourEnvironment
@@ -135,7 +135,7 @@ set APM_SERVER_URL=http://apm_host:8200
 set JVM_ARGS=-javaagent:<PATH_TO_AGENT_APM_JAR>\elastic-apm-agent-<version>.jar -Delastic.apm.service_name=%APM_SERVICE_NAME% -Delastic.apm.environment=%APM_ENVIRONMENT% -Delastic.apm.server_urls=%APM_SERVER_URL%
 
-Another solution, create a windows shell likes jmeter_with_elkapm.bat in the <JMETER_HOME>\bin: +Another solution, create a windows shell likes jmeter_with_elasticapm.bat in the <JMETER_HOME>\bin:
 set APM_SERVICE_NAME=yourServiceName
 set APM_ENVIRONMENT=yourEnvironment
@@ -144,37 +144,37 @@ set JVM_ARGS=-javaagent:<PATH_TO_AGENT_APM_JAR>\elastic-apm-agent-<vers
 
Remark the **& jmeter.bat** at end of the line with set JVM_ARGS -### Add the elastic apm library -Add the ELK apm api library in the <JMETER_HOME>\lib\apm-agent-api-<version>.jar +### Add the ELASTIC APM library +Add the ELASTIC APM api library in the <JMETER_HOME>\lib\apm-agent-api-<version>.jar This library is use by JSR223 groovy code. -Url to find the apm library : [https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api](https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api) +Url to find the ELASTIC APM library : [https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api](https://mvnrepository.com/artifact/co.elastic.apm/apm-agent-api) -## Use jmeter maven plugin and ELK java agent -You could launch a load test with the jmeter maven plugin and elk apm agent +## Use jmeter maven plugin and elastic java agent +You could launch a load test with the jmeter maven plugin and ELASTIC APM Agent [https://github.com/jmeter-maven-plugin/jmeter-maven-plugin](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin) Paths are relative to the home maven project - Put your csv files in /src/test/jmeter directory (e.g : logins.csv) -- Put the apm-agent-api-${elk_apm_version}.jar in /src/test/jmeter directory -- Put your jmeter script that contains groovy code added with **jmeter-elk-apm** tool in /src/test/jmeter directory (e.g : script1_add.jmx) -- In the maven build section, in the configuration > testPlanLibraries > declare the apm api library co.elastic.apm:apm-agent-api:${elk_apm_version} +- Put the apm-agent-api-${elastic_apm_version}.jar in /src/test/jmeter directory +- Put your jmeter script that contains groovy code added with **jmeter-elastic-apm** tool in /src/test/jmeter directory (e.g : script1_add.jmx) +- In the maven build section, in the configuration > testPlanLibraries > declare the apm api library co.elastic.apm:apm-agent-api:${elastic_apm_version} - In the jMeterProcessJVMSettings > arguments add apm agent configuration likes:
 
 
--javaagent:${project.build.directory}/jmeter/testFiles/elastic-apm-agent-${elk_apm_version}.jar
--Delastic.apm.service_name=${elk_apm_service_name}
--Delastic.apm.environment=${elk_apm_environment}
--Delastic.apm.server_urls=${elk_apm_urls}
+-javaagent:${project.build.directory}/jmeter/testFiles/elastic-apm-agent-${elastic_apm_version}.jar
+-Delastic.apm.service_name=${elastic_apm_service_name}
+-Delastic.apm.environment=${elastic_apm_environment}
+-Delastic.apm.server_urls=${elastic_apm_urls}
 
 
 
-A pom.xml example, the elk_apm_version is set to "1.37.0" for the apm agent and the apm library but you could choose another version : +A pom.xml example, the elastic_apm_version is set to "1.37.0" for the ELASTIC APM Agent agent and the ELASTIC APM library but you could choose another version : ```XML @@ -189,11 +189,11 @@ A pom.xml example, the elk_apm_version is set to "1.37.0" for the apm agent and 256 756 - - 1.37.0 - YourServiceNane - YourEnvironment - http://apm_server:8200 + + 1.37.0 + YourServiceNane + YourEnvironment + http://apm_server:8200 @@ -222,17 +222,17 @@ A pom.xml example, the elk_apm_version is set to "1.37.0" for the apm agent and 5.5 - co.elastic.apm:apm-agent-api:${elk_apm_version} + co.elastic.apm:apm-agent-api:${elastic_apm_version} false ${jvm_xms} ${jvm_xmx} - -javaagent:${project.build.directory}/jmeter/testFiles/elastic-apm-agent-${elk_apm_version}.jar - -Delastic.apm.service_name=${elk_apm_service_name} - -Delastic.apm.environment=${elk_apm_environment} - -Delastic.apm.server_urls=${elk_apm_urls} + -javaagent:${project.build.directory}/jmeter/testFiles/elastic-apm-agent-${elastic_apm_version}.jar + -Delastic.apm.service_name=${elastic_apm_service_name} + -Delastic.apm.environment=${elastic_apm_environment} + -Delastic.apm.server_urls=${elastic_apm_urls} -Duser.language=en @@ -249,12 +249,12 @@ A pom.xml example, the elk_apm_version is set to "1.37.0" for the apm agent and ``` ### Usage Maven -The maven groupId, artifactId and version, this plugin is in the **Maven Central Repository** [![Maven Central jmeter-elk-apm](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/jmeter-elk-apm/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/jmeter-elk-apm) +The maven groupId, artifactId and version, this plugin is in the **Maven Central Repository** [![Maven Central jmeter-elastic-apm](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/jmeter-elastic-apm/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/jmeter-elastic-apm) ```xml io.github.vdaburon -jmeter-elk-apm -1.1 +jmeter-elastic-apm +1.2 ``` ## Advanced usage @@ -269,14 +269,14 @@ You want to change the "JSR223 start transaction apm" with your own file. E.g. :
-java -jar jmeter-elk-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx -action ADD -regex SC.* -extract_start my_xml_file.xml
+java -jar jmeter-elastic-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx -action ADD -regex SC.* -extract_start my_xml_file.xml
 
You want to change all 3 files with yours XML files. E.g. :
-java -jar jmeter-elk-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx
+java -jar jmeter-elastic-apm-<version>-jar-with-dependencies.jar -file_in script1.jmx -file_out script1_add.jmx
 -action ADD -regex SC.* -extract_start my_xml_start_file.xml -extract_end my_xml_end_file.xml -extract_udv my_xml_udv_file.xml
 
@@ -286,22 +286,24 @@ Another solution is to open the tool jar file with 7zip and replace the 3 files This tool is looking to **reserved tags** or special string in the XML extract files or in the JMeter script to **REMOVE** previously add JSR223 Samplers and User Defined Variables. This tags are : -- In the "JSR223 groovy start transaction apm", the reserved tags are : "@@TC\_NAME" in the Parameters text field, this string will be replaced by the label of the following Transaction Controller and the "@@ELK\_APM\_BEGIN" in the Comment text field -- In the "JRS223 groovy end transaction apm", the reserved tag is "@@ELK\_APM\_END" in the Comment text field -- In the "User Defined Variables", the reserved tag is "@@ELK\_APM\_UDV" in the Comment text field +- In the "JSR223 groovy start transaction apm", the reserved tags are : "@@TC\_NAME" in the Parameters text field, this string will be replaced by the label of the following Transaction Controller and the "@@ELASTIC\_APM\_BEGIN" in the Comment text field +- In the "JRS223 groovy end transaction apm", the reserved tag is "@@ELASTIC\_APM\_END" in the Comment text field +- In the "User Defined Variables", the reserved tag is "@@ELASTIC\_APM\_UDV" in the Comment text field ## Call this tool likes a library -To call this tool in an other tool, add the jar jmeter-elk-apm-<version>-jar and this 2 libraries dependence (common-cli and org.slf4j) in the classpath and : +To call this tool in an other tool, add the jar jmeter-elastic-apm-<version>-jar and this 2 libraries dependence (common-cli and org.slf4j) in the classpath and :
-import io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager;
+import io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager;
 
 String sRegexTc = ".*";
 String sFileIn = "script1.jmx";
 String sFileOut = "script1_add.jmx";
-ElkApmJMeterManager.modifyAddSamplerForElkApm(sFileIn, sFileOut, ElkApmJMeterManager.ACTION_ADD, sRegexTc, ElkApmJMeterManager.EXTRACT_START_JSR223, ElkApmJMeterManager.EXTRACT_END_JSR223, ElkApmJMeterManager.EXTRACT_UDV_ELK);
+ElasticApmJMeterManager.modifyAddSamplerForelasticApm(sFileIn, sFileOut, ElasticApmJMeterManager.ACTION_ADD, sRegexTc, ElasticApmJMeterManager.EXTRACT_START_JSR223, ElasticApmJMeterManager.EXTRACT_END_JSR223, ElasticApmJMeterManager.EXTRACT_UDV_elastic);
 
## Version +Version 1.2 change globally ELK to ELASTIC + Version 1.1 correct the class name in the uber jar and correct REMOVE result Version 1.0 first version of this tool. diff --git a/doc/images/architecture_jmeter_tomcat_elastic_apm.png b/doc/images/architecture_jmeter_tomcat_elastic_apm.png new file mode 100644 index 0000000..eb24e05 Binary files /dev/null and b/doc/images/architecture_jmeter_tomcat_elastic_apm.png differ diff --git a/doc/images/architecture_jmeter_tomcat_elk.png b/doc/images/architecture_jmeter_tomcat_elk.png deleted file mode 100644 index a770853..0000000 Binary files a/doc/images/architecture_jmeter_tomcat_elk.png and /dev/null differ diff --git a/doc/images/script_add.png b/doc/images/script_add.png index 665a818..6410472 100644 Binary files a/doc/images/script_add.png and b/doc/images/script_add.png differ diff --git a/doc/images/udv_elastic_properties.png b/doc/images/udv_elastic_properties.png new file mode 100644 index 0000000..5a633a4 Binary files /dev/null and b/doc/images/udv_elastic_properties.png differ diff --git a/doc/images/udv_elkp_properties.png b/doc/images/udv_elkp_properties.png deleted file mode 100644 index 05f06b8..0000000 Binary files a/doc/images/udv_elkp_properties.png and /dev/null differ diff --git a/pom.xml b/pom.xml index b145ddb..d280cc3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,11 +5,11 @@ 4.0.0 io.github.vdaburon - jmeter-elk-apm - 1.1 + jmeter-elastic-apm + 1.2 jar - Manage ELK APM integration for Apache JMeter - ADD/REMOVE ELK APM library api call around Transaction Controller, you will see timeline and sub calls for the Transaction Controller (Page) in Kibana + 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 https://github.com/vdaburon/jmeter-elk-apm 2024 @@ -39,9 +39,9 @@ - https://github.com/vdaburon/jmeter-elk-apm.git - https://github.com/vdaburon/jmeter-elk-apm.git - https://github.com/vdaburon/jmeter-elk-apm + https://github.com/vdaburon/jmeter-elastic-apm.git + https://github.com/vdaburon/jmeter-elasitc-apm.git + https://github.com/vdaburon/jmeter-elastic-apm HEAD @@ -131,7 +131,7 @@ - io.github.vdaburon.jmeter.elkapmxml.ElkApmJMeterManager + io.github.vdaburon.jmeter.elasticapmxml.ElasticApmJMeterManager diff --git a/src/main/java/io/github/vdaburon/jmeter/elkapmxml/ElkApmJMeterManager.java b/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java similarity index 95% rename from src/main/java/io/github/vdaburon/jmeter/elkapmxml/ElkApmJMeterManager.java rename to src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java index 0ea942f..4cd5163 100644 --- a/src/main/java/io/github/vdaburon/jmeter/elkapmxml/ElkApmJMeterManager.java +++ b/src/main/java/io/github/vdaburon/jmeter/elasticapmxml/ElasticApmJMeterManager.java @@ -1,4 +1,4 @@ -package io.github.vdaburon.jmeter.elkapmxml; +package io.github.vdaburon.jmeter.elasticapmxml; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -27,13 +27,13 @@ import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -public class ElkApmJMeterManager { - private static final Logger LOGGER = LoggerFactory.getLogger(ElkApmJMeterManager.class); +public class ElasticApmJMeterManager { + private static final Logger LOGGER = LoggerFactory.getLogger(ElasticApmJMeterManager.class); // fixed string to find in the jmeter script or in the extracted xml files private static final String PARAM_TC_NAME = "@@TC_NAME"; - private static final String COMMENT_BEGIN_ELK_APM = "@@ELK_APM_BEGIN"; - private static final String COMMENT_END_ELK_APM = "@@ELK_APM_END"; - private static final String COMMENT_APM_UDV = "@@ELK_APM_UDV"; + private static final String COMMENT_BEGIN_ELASTIC_APM = "@@ELASTIC_APM_BEGIN"; + private static final String COMMENT_END_ELASTIC_APM = "@@ELASTIC_APM_END"; + private static final String COMMENT_APM_UDV = "@@ELASTIC_APM_UDV"; // CLI OPTIONS public static final String K_JMETER_FILE_IN_OPT = "file_in"; @@ -278,10 +278,10 @@ private static LinkedList addSamplerForElkApm(LinkedList lkfileJ private static LinkedList removeSamplerForElkApm(LinkedList lkfileJMeterOrig, String regexTc, LinkedList lkStart, LinkedList lkEnd, LinkedList lkUdvUnderTp) { LinkedList lkReturn = new LinkedList(); - Pattern patternCommentStartEltTc = Pattern.compile(".*?" + COMMENT_BEGIN_ELK_APM + ""); // JSR223 for begin transaction + Pattern patternCommentStartEltTc = Pattern.compile(".*?" + COMMENT_BEGIN_ELASTIC_APM + ""); // JSR223 for begin transaction Pattern patternStartEltJsr223 = Pattern.compile(".*?" + COMMENT_END_ELK_APM + ""); // JSR223 for end transaction + Pattern patternCommentEndEltTc = Pattern.compile(".*?" + COMMENT_END_ELASTIC_APM + ""); // JSR223 for end transaction Pattern patternCommentEltArgument = Pattern.compile(".*?" + COMMENT_APM_UDV + ""); // UDV with ELK_APM_UDV Pattern patternStartEltArguments = Pattern.compile(".*? - @@ELK_APM_END + @@ELASTIC_APM_END \ No newline at end of file diff --git a/src/main/resources/extract_start_transaction_ignore_jsr223.xml b/src/main/resources/extract_start_transaction_ignore_jsr223.xml index 70badc8..516ab12 100644 --- a/src/main/resources/extract_start_transaction_ignore_jsr223.xml +++ b/src/main/resources/extract_start_transaction_ignore_jsr223.xml @@ -28,6 +28,6 @@ if (sAPM_ACTIVE == null || "TRUE".equalsIgnoreCase(sAPM_ACTIVE)) { log.error("Exception ex = " + ex.toString()); } } - @@ELK_APM_BEGIN + @@ELASTIC_APM_BEGIN diff --git a/src/main/resources/extract_udv_elk_under_testplan.xml b/src/main/resources/extract_udv_elk_under_testplan.xml index d120758..3b5da29 100644 --- a/src/main/resources/extract_udv_elk_under_testplan.xml +++ b/src/main/resources/extract_udv_elk_under_testplan.xml @@ -13,6 +13,6 @@ = - @@ELK_APM_UDV + @@ELASTIC_APM_UDV \ No newline at end of file