generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/metrics for 1.7 release (#1356)
* Feature/monitoring (#1306) * ongoing metrics redefinition * configured kafka-ui, resorted services * change visibility * wip: new gauge * new logging * more logging * #1251: move event EventMessageCountingMonitor setup to constructor. add /actuator/prometheus to permitted paths * create additional metrics for tasks, reduce loggingin integration itests * confgured monitoring * tasklist service fix prometheus path * remove unnneded config * rename metric to match the sender side * rename label --------- Co-authored-by: stephan.strehler <[email protected]> Co-authored-by: Simon Hirtreiter <[email protected]> * configurble metrics, fix #1338 (#1353) * configurble metrics, fix #1338 * Update digiwf-engine/digiwf-engine-service/src/main/resources/application.yml Co-authored-by: Simon Hirtreiter <[email protected]> * Update digiwf-libs/digiwf-camunda-prometheus/digiwf-camunda-prometheus-starter/src/main/java/de/muenchen/oss/digiwf/camunda/prometheus/MetricsProviderSchedulerAutoConfiguration.java Co-authored-by: Simon Hirtreiter <[email protected]> * Update digiwf-libs/digiwf-camunda-prometheus/digiwf-camunda-prometheus-starter/src/main/java/de/muenchen/oss/digiwf/camunda/prometheus/CamundaPrometheusProperties.java Co-authored-by: Simon Hirtreiter <[email protected]> --------- Co-authored-by: Simon Hirtreiter <[email protected]> --------- Co-authored-by: Simon Zambrovski <[email protected]> Co-authored-by: stephan.strehler <[email protected]>
- Loading branch information
1 parent
36e9d4c
commit e0f5fa5
Showing
50 changed files
with
935 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...oft/digiwf-dms-integration-fabasoft-mock-service/src/test/resources/application-itest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
logging: | ||
level: | ||
org.apache.kafka.clients.admin: WARN | ||
org.apache.kafka.clients.consumer: WARN | ||
org.apache.kafka.clients.producer: WARN | ||
|
||
# overwrite vars | ||
DIGIWF_ENV: itest | ||
#KAFKA_BOOTSTRAP_SERVER: localhost | ||
#KAFKA_BOOTSTRAP_SERVER_PORT: 19999 | ||
#KAFKA_SECURITY_PROTOCOL: PLAINTEXT |
11 changes: 11 additions & 0 deletions
11
...e-integration/digiwf-example-integration-service/src/test/resources/application-itest.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
logging: | ||
level: | ||
org.apache.kafka.clients.admin: WARN | ||
org.apache.kafka.clients.consumer: WARN | ||
org.apache.kafka.clients.producer: WARN | ||
|
||
# overwrite vars | ||
DIGIWF_ENV: itest | ||
#KAFKA_BOOTSTRAP_SERVER: localhost | ||
#KAFKA_BOOTSTRAP_SERVER_PORT: 19999 | ||
#KAFKA_SECURITY_PROTOCOL: PLAINTEXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...-core/src/main/java/de/muenchen/oss/digiwf/camunda/prometheus/ExecutionEventReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package de.muenchen.oss.digiwf.camunda.prometheus; | ||
|
||
import io.prometheus.client.CollectorRegistry; | ||
import io.prometheus.client.Counter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.camunda.bpm.engine.RepositoryService; | ||
import org.camunda.bpm.engine.delegate.DelegateExecution; | ||
import org.springframework.context.event.EventListener; | ||
|
||
@RequiredArgsConstructor | ||
public class ExecutionEventReporter implements MetricsReporter { | ||
|
||
private final RepositoryService repositoryService; | ||
private Counter startExecutionEvents; | ||
private Counter endExecutionEvents; | ||
|
||
@Override | ||
public void registerMetrics(CollectorRegistry collectorRegistry) { | ||
this.startExecutionEvents = Counter.build() | ||
.name("camunda_start_process_events_count") | ||
.help("Start process events by process definition.") | ||
.labelNames("processDefinitionKey") | ||
.register(collectorRegistry); | ||
this.endExecutionEvents = Counter.build() | ||
.name("camunda_end_process_events_count") | ||
.help("End process events by process definition.") | ||
.labelNames("processDefinitionKey") | ||
.register(collectorRegistry); | ||
} | ||
|
||
@EventListener(condition = "#execution.eventName.equals('start')") | ||
public void countStartEvent(DelegateExecution execution) { | ||
if (isModelElementOfType("startEvent", execution)) { | ||
startExecutionEvents.labels(getProcessDefinitionKey(execution)).inc(); | ||
} | ||
} | ||
|
||
@EventListener(condition = "#execution.eventName.equals('end')") | ||
public void countEndEvent(DelegateExecution execution) { | ||
if (isModelElementOfType("endEvent", execution)) { | ||
endExecutionEvents.labels(getProcessDefinitionKey(execution)).inc(); | ||
} | ||
} | ||
|
||
private static boolean isModelElementOfType(String typeName, DelegateExecution execution) { | ||
return execution.getBpmnModelElementInstance() != null | ||
&& typeName.equals(execution.getBpmnModelElementInstance().getElementType().getTypeName()); | ||
} | ||
|
||
private String getProcessDefinitionKey(DelegateExecution execution) { | ||
return repositoryService.getProcessDefinition(execution.getProcessDefinitionId()).getKey(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...us-core/src/main/java/de/muenchen/oss/digiwf/camunda/prometheus/HistoryEventReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package de.muenchen.oss.digiwf.camunda.prometheus; | ||
|
||
import io.prometheus.client.CollectorRegistry; | ||
import io.prometheus.client.Summary; | ||
import org.camunda.bpm.engine.impl.history.event.HistoricActivityInstanceEventEntity; | ||
import org.springframework.context.event.EventListener; | ||
|
||
public class HistoryEventReporter implements MetricsReporter { | ||
|
||
private Summary camundaActivityTime; | ||
|
||
@Override | ||
public void registerMetrics(CollectorRegistry collectorRegistry) { | ||
camundaActivityTime = Summary.build() | ||
.quantile(0.5, 0.05) | ||
.quantile(0.9, 0.01) | ||
.quantile(0.99, 0.001) | ||
.name("camunda_activity_execution_time_milliseconds") | ||
.labelNames("processDefinitionKey", "activityType", "activityName") | ||
.help("Duration of activities in milliseconds.") | ||
.register(collectorRegistry); | ||
} | ||
|
||
/** | ||
* Observes the duration of any ended camunda activity | ||
* | ||
* @param historyEvent the caught event | ||
*/ | ||
@EventListener(condition = "#historyEvent != null && #historyEvent.eventType.equals('end')") | ||
public void handleEvent(HistoricActivityInstanceEventEntity historyEvent) { | ||
|
||
String activityName = historyEvent.getActivityName(); | ||
if (activityName == null || activityName.isEmpty()) { | ||
activityName = historyEvent.getActivityId(); | ||
} | ||
|
||
if (historyEvent.getDurationInMillis() != null) { | ||
camundaActivityTime | ||
.labels(historyEvent.getProcessDefinitionKey(), historyEvent.getActivityType(), activityName) | ||
.observe(historyEvent.getDurationInMillis()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.