-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
50 additions
and
3 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
37 changes: 37 additions & 0 deletions
37
util/src/main/java/io/camunda/zeebe/util/sched/ActorMetrics.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,37 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.util.sched; | ||
|
||
import io.prometheus.client.Counter; | ||
import io.prometheus.client.Histogram; | ||
|
||
public class ActorMetrics { | ||
|
||
private static final Histogram EXECUTION_LATENCY = | ||
Histogram.build() | ||
.namespace("zeebe") | ||
.name("sched_task_execution_latency") | ||
.help("Latency to execute") | ||
.labelNames("actorName") | ||
.register(); | ||
|
||
private static final Counter EXECUTION_COUNT = | ||
Counter.build() | ||
.namespace("zeebe") | ||
.name("sched_task_execution_count") | ||
.labelNames("actorName") | ||
.register(); | ||
|
||
public Histogram.Timer startExecutionTimer(final String name) { | ||
return EXECUTION_LATENCY.labels(name).startTimer(); | ||
} | ||
|
||
public void countExecution(final String name) { | ||
EXECUTION_COUNT.labels(name).inc(); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
|
||
public class ActorThread extends Thread implements Consumer<Runnable> { | ||
static final Unsafe UNSAFE = UnsafeAccess.UNSAFE; | ||
static final ActorMetrics ACTOR_METRICS = new ActorMetrics(); | ||
private static final long STATE_OFFSET; | ||
private static final Logger LOG = Loggers.ACTOR_LOGGER; | ||
private static final FatalErrorHandler FATAL_ERROR_HANDLER = FatalErrorHandler.withLogger(LOG); | ||
|
@@ -77,7 +78,12 @@ private void doWork() { | |
|
||
if (currentTask != null) { | ||
try { | ||
executeCurrentTask(); | ||
final var actorName = currentTask.actor.getName(); | ||
ACTOR_METRICS.countExecution(actorName); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Zelldon
Author
Member
|
||
try (final var timer = ACTOR_METRICS.startExecutionTimer(actorName)) { | ||
executeCurrentTask(); | ||
} | ||
|
||
} finally { | ||
taskScheduler.onTaskReleased(currentTask); | ||
} | ||
|
@pihme with that you could at least see which actor has been executed mostly and how long does it took. But it is not that fine granular on method level, like you described here #9282 (comment)