Skip to content

Commit

Permalink
Close camunda-community-hub#83: provide camunda metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
arolfes committed Mar 18, 2021
1 parent 45b4209 commit 05c22af
Show file tree
Hide file tree
Showing 29 changed files with 12,298 additions and 0 deletions.
56 changes: 56 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 @@ -636,6 +637,61 @@ 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>

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
2 changes: 2 additions & 0 deletions micronaut-camunda-bpm-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ 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
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 05c22af

Please sign in to comment.