Skip to content

Commit

Permalink
Add graphite listener
Browse files Browse the repository at this point in the history
  • Loading branch information
rabelenda-abstracta committed Jan 29, 2024
1 parent 840b615 commit 4e75600
Show file tree
Hide file tree
Showing 17 changed files with 2,342 additions and 7 deletions.
38 changes: 38 additions & 0 deletions docs/guide/reporting/real-time/graphite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#### Graphite

In a similar fashion to InfluxDB, you can use Graphite and Grafana. Here is an example test plan using the `graphiteListener`:

```java
import static org.assertj.core.api.Assertions.assertThat;
import static us.abstracta.jmeter.javadsl.JmeterDsl.*;

import java.io.IOException;
import java.time.Duration;
import org.junit.jupiter.api.Test;
import us.abstracta.jmeter.javadsl.core.TestPlanStats;

public class PerformanceTest {

@Test
public void testPerformance() throws IOException {
TestPlanStats stats = testPlan(
threadGroup(2, 10,
httpSampler("http://my.service")
),
graphiteListener("localhost:2004")
).run();
assertThat(stats.overall().sampleTimePercentile99()).isLessThan(Duration.ofSeconds(5));
}

}
```

As in the InfluxDB scenario, you can try it locally by running `docker-compose up` (previously [installing Docker](https://docs.docker.com/get-docker/) in your machine) inside [this directory](/docs/guide/reporting/real-time/graphite). After containers are started, you can follow the same steps as in the InfluxDB scenario.

::: warning
Use the provided `docker-compose` settings for local tests only. It uses weak credentials and is not properly configured for production purposes.
:::

::: warning
`graphiteListener` is configured to use Pickle Protocol, and port 2004, by default. This is more efficient than text plain protocol, which is the one used by default by JMeter.
:::
28 changes: 28 additions & 0 deletions docs/guide/reporting/real-time/graphite/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'
services:
graphite:
image: graphiteapp/graphite-statsd:1.1.10-5
ports:
- '2003:2003'
- '2004:2004'
- '8080:80'
volumes:
- ./graphite-conf/carbon.conf:/opt/graphite/conf/carbon.conf
- ./graphite-conf/storage-schemas.conf:/opt/graphite/conf/storage-schemas.conf
- graphite-data:/opt/graphite/storage/whisper
grafana:
image: grafana/grafana:8.1.1
ports:
- '3000:3000'
volumes:
- grafana-data:/var/lib/grafana
- ./grafana-provisioning/:/etc/grafana/provisioning
depends_on:
- graphite
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=1234
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/jmeter.json
volumes:
graphite-data:
grafana-data:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: 1
providers:
- name: JMeter Dashboards
allowUiUpdates: true
options:
path: /etc/grafana/provisioning/dashboards
Loading

0 comments on commit 4e75600

Please sign in to comment.