Skip to content

Commit

Permalink
Close #83: provide camunda metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
arolfes committed Mar 22, 2021
1 parent 2c00382 commit 02b3081
Show file tree
Hide file tree
Showing 30 changed files with 6,858 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Micronaut + Camunda = :heart:
* [Transaction Management](#transaction-management)
* [Process Tests](#process-tests)
* [Docker](#docker)
* [Camunda Metrics](#camunda-metrics)
* [Pitfalls](#pitfalls)
* [Releases](#releases)
* [Contact](#contact)
Expand Down Expand Up @@ -668,6 +669,63 @@ Run the Docker image:

`docker run -p 8080:8080 <IMAGE>`

## Camunda Metrics

To export Camunda Metrics via micronaut-micrometer you need to add the dependency and enable it __explicitly__ in your `application.yml`.

We currently support all Camunda Build-In Metrics. See [Process Engine / Metrics](https://docs.camunda.org/manual/latest/user-guide/process-engine/metrics/)

<details>
<summary>Click to show Gradle dependencies</summary>

```groovy
implementation("io.micronaut.micrometer:micronaut-micrometer-core")
// optional enable http endpoint for metrics
implementation("io.micronaut:micronaut-management")
```
</details>

<details>
<summary>Click to show Maven dependencies</summary>

```xml
<dependency>
<groupId>io.micronaut.micrometer</groupId>
<artifactId>micronaut-micrometer-core</artifactId>
</dependency>
<!-- optional enable http endpoint for metrics -->
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-management</artifactId>
</dependency>
```
</details>

<details>
<summary>Click to show configuration</summary>

```yaml
micronaut:
metrics:
binders:
camunda:
bpmnExecution:
enabled: true
dmnExecution:
enabled: true
jobExecutor:
enabled: true
historyCleanUp:
enabled: true
```
</details>

Be aware that `camunda.generic-properties.properties.metricsEnabled=false` overrules all other settings. In this case no metrics are enabled.

One note about performance: Take into consideration the execution times of your metric collectors. Each metric collector is run as a standalone timer thread execution, but the more collectors you add, and the large the data processing and/or database query time/load the collector uses per execution, it can create large performance impacts on the engine.

## Pitfalls

### No version information in Fat/Uber/Shadow JAR
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions micronaut-camunda-bpm-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,24 @@ the data source's URL:
`datasources.default.url: jdbc:h2:file:~/micronautdb;DB_CLOSE_ON_EXIT=FALSE`

To reset the database simply delete the `micronautdb*` files in your home directory.

## Monitoring

By default, the example app will print the metrics every minute to console. To disable this open `src/main/resources/application.yml`
and change `micronaut.metrics.export.logging.enabled` to `false`

![Camunda Metrics Console](CamundaMetrics-Console.png)

The app comes also with an prometheus endpoint. To see prometheus and grafana in action open a shell

![Camunda Metrics](CamundaMetrics-Grafana.png)

```shell
export UID=$(id -u)
export GID=$(id -g)
docker-compose up
```

Open [grafana](http://localhost:3000/) in your browser. Username and Password is `admin`.

We added 2 Dashboards. One for JVM Metrics and one for all camunda build-in metrics.
12 changes: 12 additions & 0 deletions micronaut-camunda-bpm-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ micronaut {

dependencies {
implementation(project(":micronaut-camunda-bpm-feature"))

// imported to enable http endpoint for metrics
implementation("io.micronaut:micronaut-management")


// imported to activate metrics
// comes also with micronaut-micrometer-registry-prometheus, it's here just to make the example more verbose
implementation("io.micronaut.micrometer:micronaut-micrometer-core")

// just added to export metrics to prometheus, start it via docker-compose
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus")

runtimeOnly("com.h2database:h2")
runtimeOnly("ch.qos.logback:logback-classic")

Expand Down
23 changes: 23 additions & 0 deletions micronaut-camunda-bpm-example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3.8'
services:

prometheus:
image: prom/prometheus:latest
volumes:
- ./src/test/resources/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- '9090:9090'
network_mode: host

grafana:
image: grafana/grafana:latest
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
depends_on:
- prometheus
ports:
- "3000:3000"
network_mode: host
user: $UID:$GID
volumes:
- ./src/test/resources/grafana/:/etc/grafana/provisioning/
22 changes: 22 additions & 0 deletions micronaut-camunda-bpm-example/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
micronaut:
application:
name: micronaut-camunda-example
metrics:
export:
logging:
step: PT1M
enabled: true
prometheus:
enabled: true
step: PT1M
descriptions: true
binders:
camunda:
bpmnExecution:
enabled: true
dmnExecution:
enabled: true
jobExecutor:
enabled: true
historyCleanUp:
enabled: true
endpoints:
prometheus:
sensitive: false
camunda:
admin-user:
id: admin
Expand Down
Loading

0 comments on commit 02b3081

Please sign in to comment.