Skip to content

Commit a5cd54d

Browse files
committed
Fixed Codacy reported issues
1 parent 9dd474c commit a5cd54d

File tree

2 files changed

+122
-99
lines changed

2 files changed

+122
-99
lines changed

README.md

Lines changed: 107 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,44 @@ A JMeter plug-in that enables you to send test results to a Kafka server.
99
# Overview
1010

1111
### Description
12+
1213
JMeter Backend Listener Kafka is a JMeter plugin enabling you to send test results to a Kafka server.
1314
It is inspired from JMeter [ElasticSearch](https://github.com/delirius325/jmeter-elasticsearch-backend-listener) backend listener plug-in.
1415

1516
### Features
1617

17-
* Filters
18-
* Only send the samples you want, by using Filters! Simply type them as follows in the appropriate field: ``filter1;filter2;filter3`` or ``sampleLabel_must_contain_this``.
19-
* Specific fields `field1;field2;field3`
20-
* Specify fields that you want to send to Kafka (possible fields below):
21-
* AllThreads
22-
* BodySize
23-
* Bytes
24-
* SentBytes
25-
* ConnectTime
26-
* ContentType
27-
* DataType
28-
* ErrorCount
29-
* GrpThreads
30-
* IdleTime
31-
* Latency
32-
* ResponseTime
33-
* SampleCount
34-
* SampleLabel
35-
* ThreadName
36-
* URL
37-
* ResponseCode
38-
* TestStartTime
39-
* SampleStartTime
40-
* SampleEndTime
41-
* Timestamp
42-
* InjectorHostname
43-
* Verbose, semi-verbose, error only, and quiet mode:
44-
* __debug__ : Send request/response information of all samplers (headers, body, etc.)
45-
* __info__ : Sends all samplers to the Kafka server, but only sends the headers, body info for the failed samplers.
46-
* __quiet__ : Only sends the response time, bytes, and other metrics
47-
* __error__ : Only sends the failing samplers to the Kafka server (Along with their headers and body information).
48-
* Use Logstash/NiFi or any other tool to consume data from Kafka topic and then ingest it into a Database of your liking.
18+
- Filters
19+
- Only send the samples you want, by using Filters! Simply type them as follows in the appropriate field: `filter1;filter2;filter3` or `sampleLabel_must_contain_this`.
20+
- Specific fields `field1;field2;field3`
21+
- Specify fields that you want to send to Kafka (possible fields below):
22+
- AllThreads
23+
- BodySize
24+
- Bytes
25+
- SentBytes
26+
- ConnectTime
27+
- ContentType
28+
- DataType
29+
- ErrorCount
30+
- GrpThreads
31+
- IdleTime
32+
- Latency
33+
- ResponseTime
34+
- SampleCount
35+
- SampleLabel
36+
- ThreadName
37+
- URL
38+
- ResponseCode
39+
- TestStartTime
40+
- SampleStartTime
41+
- SampleEndTime
42+
- Timestamp
43+
- InjectorHostname
44+
- Verbose, semi-verbose, error only, and quiet mode:
45+
- **debug** : Send request/response information of all samplers (headers, body, etc.)
46+
- **info** : Sends all samplers to the Kafka server, but only sends the headers, body info for the failed samplers.
47+
- **quiet** : Only sends the response time, bytes, and other metrics
48+
- **error** : Only sends the failing samplers to the Kafka server (Along with their headers and body information).
49+
- Use Logstash/NiFi or any other tool to consume data from Kafka topic and then ingest it into a Database of your liking.
4950

5051
### Maven dependency
5152

@@ -59,61 +60,63 @@ It is inspired from JMeter [ElasticSearch](https://github.com/delirius325/jmeter
5960

6061
### Installing JMeter
6162

62-
- SSH to a Unix machine with X-11 Forwarding enabled, and then set DISPLAY variable:
63+
- SSH to a Unix machine with X-11 Forwarding enabled, and then set DISPLAY variable:
64+
65+
```bash
66+
export DISPLAY=Your_terminal_IP:0.0
67+
```
6368

64-
```bash
65-
export DISPLAY=Your_terminal_IP:0.0
66-
```
69+
- Download [JMeter](https://jmeter.apache.org/download_jmeter.cgi) binary and extract it:
6770

68-
- Download [JMeter](https://jmeter.apache.org/download_jmeter.cgi) binary and extract it:
69-
70-
```bash
71-
mkdir -P /home/jmeter
72-
cd /home/jmeter
73-
curl -O -k http://mirror.vorboss.net/apache//jmeter/binaries/apache-jmeter-5.1.1.tgz
74-
tar -zxvf apache-jmeter-5.1.1.tgz
75-
ln -s apache-jmeter-5.1.1 ./current
76-
export JMETER_HOME=/data/elastic/jmeter/current
77-
```
71+
```bash
72+
mkdir -P /home/jmeter
73+
cd /home/jmeter
74+
curl -O -k http://mirror.vorboss.net/apache//jmeter/binaries/apache-jmeter-5.1.1.tgz
75+
tar -zxvf apache-jmeter-5.1.1.tgz
76+
ln -s apache-jmeter-5.1.1 ./current
77+
export JMETER_HOME=/data/elastic/jmeter/current
78+
```
7879

79-
- Download and install [Plugin Manager](https://jmeter-plugins.org/wiki/PluginsManager/) to `lib/ext` folder:
80+
- Download and install [Plugin Manager](https://jmeter-plugins.org/wiki/PluginsManager/) to `lib/ext` folder:
8081

81-
```bash
82-
curl -O -k http://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/1.3/jmeter-plugins-manager-1.3.jar
83-
mv jmeter-plugins-manager-1.3.jar apache-jmeter-5.1.1/lib/ext/
84-
```
85-
86-
Detailed instructions on installing Plug-ins Manager are available at this [blog](https://octoperf.com/blog/2018/04/04/jmeter-plugins-install/).
82+
```bash
83+
curl -O -k http://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/1.3/jmeter-plugins-manager-1.3.jar
84+
mv jmeter-plugins-manager-1.3.jar apache-jmeter-5.1.1/lib/ext/
85+
```
8786

88-
- Start JMeter:
87+
Detailed instructions on installing Plug-ins Manager are available at this [blog](https://octoperf.com/blog/2018/04/04/jmeter-plugins-install/).
8988

90-
```bash
91-
cd $JMETER_HOME
92-
JVM_ARGS="-Dhttps.proxyHost=myproxy.com -Dhttps.proxyPort=8080 -Dhttp.proxyUser=user -Dhttp.proxyPass=***" ./bin/jmeter.sh
93-
```
89+
- Start JMeter:
90+
91+
```bash
92+
cd $JMETER_HOME
93+
JVM_ARGS="-Dhttps.proxyHost=myproxy.com -Dhttps.proxyPort=8080 -Dhttp.proxyUser=user -Dhttp.proxyPass=***" ./bin/jmeter.sh
94+
```
9495

9596
### Packaging and testing your newly added code
9697

97-
- Build the artefact: Execute below mvn command. Make sure JAVA_HOME is set properly
98+
- Build the artefact: Execute below mvn command. Make sure JAVA_HOME is set properly
99+
100+
```bash
101+
mvn clean package
102+
```
98103

99-
```bash
100-
mvn clean package
101-
```
104+
- Move the resulting JAR to your `JMETER_HOME/lib/ext`.
102105

103-
- Move the resulting JAR to your `JMETER_HOME/lib/ext`.
106+
```bash
107+
mv target/jmeter.backendlistener.kafka-1.0.0-SNAPSHOT.jar $JMETER_HOME/lib/ext/
108+
```
104109

105-
```bash
106-
mv target/jmeter.backendlistener.kafka-1.0.0-SNAPSHOT.jar $JMETER_HOME/lib/ext/
107-
```
110+
- Restart JMeter
108111

109-
- Restart JMeter
110-
- Go to Options > Plugins Manager
111-
- You will find Kafka Backend listener plug-in mentioned in the Installed plug-ins tab.
112+
- Go to Options > Plugins Manager
113+
114+
- You will find Kafka Backend listener plug-in mentioned in the Installed plug-ins tab.
112115

113116
### Configuring jmeter-backend-listener-kafka plug-in
114117

115-
- In your **Test Pan**, right click on **Thread Group** > Add > Listener > Backend Listener
116-
- Specify parameters as shown in image below (**bootstrap.servers** and **kafka.topic** are mandatory ones):
118+
- In your **Test Pan**, right click on **Thread Group** > Add > Listener > Backend Listener
119+
- Specify parameters as shown in image below (**bootstrap.servers** and **kafka.topic** are mandatory ones):
117120

118121
![Screenshot of configuration](docs/configuration.JPG "Screenshot of configuration")
119122

@@ -133,14 +136,36 @@ Feel free to contribute by branching and making pull requests, or simply by sugg
133136
134137
### Code Styling
135138
136-
- Please find instructions [here](https://github.com/HPI-Information-Systems/Metanome/wiki/Installing-the-google-styleguide-settings-in-intellij-and-eclipse) on how to configure your IntelliJ or Eclipse to format the source code according to Google style.
137-
Once configured in IntelliJ, format code as normal with `Ctrl + Alt + L`.
138-
139-
Adding the XML file alone and auto-formatting the whole document could replace imports with wildcard imports, which isn't always what we want.
140-
141-
- To stop this from happening, Go to `File``Settings``Editor``Code Style``Java` and select the `Imports` tab.
142-
- Set `Class Count to use import with '*'` and `Names count to us static import with '*'` to a higher value; anything over `999` should be fine.
143-
144-
You can now reformat code throughout your project without imports being changed to Wildcard imports.
145-
146-
- You also need to use `maven-git-code-format` plugin in `pom.xml` to auto format the code according to Google code style before any Git commit.
139+
- Please find instructions [here](https://github.com/HPI-Information-Systems/Metanome/wiki/Installing-the-google-styleguide-settings-in-intellij-and-eclipse) on how to configure your IntelliJ or Eclipse to format the source code according to Google style.
140+
Once configured in IntelliJ, format code as normal with `Ctrl + Alt + L`.
141+
142+
Adding the XML file alone and auto-formatting the whole document could replace imports with wildcard imports, which isn't always what we want.
143+
144+
- To stop this from happening, Go to `File``Settings``Editor``Code Style``Java` and select the `Imports` tab.
145+
- Set `Class Count to use import with '*'` and `Names count to us static import with '*'` to a higher value; anything over `999` should be fine.
146+
147+
You can now reformat code throughout your project without imports being changed to Wildcard imports.
148+
149+
- You also need to use `maven-git-code-format` plugin in `pom.xml` to auto format the code according to Google code style before any Git commit.
150+
151+
### [Markdown formatting](https://github.com/remarkjs/remark/tree/master/packages/remark-cli)
152+
153+
Use **remark-cli** to format markdown files.
154+
It ensures a single style is used: list items use one type of bullet (_, -, +), emphasis (_ or \_) and importance (\_\_ or \*\*) use a standard marker, table fences are aligned, and more.
155+
156+
- Install `remark-cli` and `remark-preset-lint-recommended`
157+
158+
```bash
159+
npm install remark-cli -g
160+
npm install remark-preset-lint-recommended -g
161+
162+
# Add a table of contents to `README.md`
163+
remark README.md --use toc --output
164+
165+
# Lint markdown files in the current directory
166+
# according to the markdown style guide.
167+
remark README.md --use remark-preset-lint-recommended -o
168+
169+
# Rewrite all applicable files
170+
remark . -o
171+
```

plugins-repo.json

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
[
2-
{
3-
"id": "jmeter.backendlistener.kafka",
4-
"name": "Kafka backend listener",
5-
"description": "Apache JMeter plugin for sending sample results to a Kafka server. <ul><li>Simply add a \"Backend Listener\" and change the implementation</li><li>Change the listener's configuration</li><li>To use filters, simply separate their name by a semicolon. (f1;f2;f3)</li></ul>",
6-
"helpUrl": "https://github.com/rahulsinghai/jmeter-backend-listener-kafka/issues",
7-
"screenshotUrl": "https://github.com/rahulsinghai/jmeter-backend-listener-kafka/blob/master/docs/configuration.JPG",
8-
"vendor": "rahulsinghai",
9-
"markerClass": "io.github.rahulsinghai.jmeter.backendlistener.kafka.KafkaBackendClient",
10-
"versions": {
11-
"1.0.0": {
12-
"changes": "Initial version.",
13-
"downloadUrl": "https://search.maven.org/remotecontent?filepath=io/github/rahulsinghai/jmeter.backendlistener.kafka/1.0.0/jmeter.backendlistener.kafka-1.0.0.jar",
14-
"depends": [
15-
]
16-
}
1+
{
2+
"id": "jmeter.backendlistener.kafka",
3+
"name": "Kafka backend listener",
4+
"description": "Apache JMeter plugin for sending sample results to a Kafka server. <ul><li>Simply add a \"Backend Listener\" and change the implementation</li><li>Change the listener's configuration</li><li>To use filters, simply separate their name by a semicolon. (f1;f2;f3)</li></ul>",
5+
"helpUrl": "https://github.com/rahulsinghai/jmeter-backend-listener-kafka/issues",
6+
"screenshotUrl": "https://github.com/rahulsinghai/jmeter-backend-listener-kafka/blob/master/docs/configuration.JPG",
7+
"vendor": "rahulsinghai",
8+
"markerClass": "io.github.rahulsinghai.jmeter.backendlistener.kafka.KafkaBackendClient",
9+
"versions": {
10+
"1.0.0": {
11+
"changes": "Initial version.",
12+
"downloadUrl": "https://search.maven.org/remotecontent?filepath=io/github/rahulsinghai/jmeter.backendlistener.kafka/1.0.0/jmeter.backendlistener.kafka-1.0.0.jar",
13+
"depends": [
14+
]
1715
}
1816
}
19-
]
17+
}

0 commit comments

Comments
 (0)