Skip to content

Monitor rule execution duration#5358

Open
querdenker2k wants to merge 8 commits intoopenhab:mainfrom
querdenker2k:monitor-rule-execution-duration
Open

Monitor rule execution duration#5358
querdenker2k wants to merge 8 commits intoopenhab:mainfrom
querdenker2k:monitor-rule-execution-duration

Conversation

@querdenker2k
Copy link
Copy Markdown

@querdenker2k querdenker2k commented Feb 14, 2026

[Metrics] Monitor rule execution duration

Description

With this you can monitor the execution duration of your rules, to see whats running slow.
This is added via metrics (prometheus).
The execution time is as well printed to the logs.

Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Signed-off-by: querdenker2k <querdenker2k@gmx.de>
@querdenker2k querdenker2k requested a review from a team as a code owner February 14, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to add observability around rule performance by emitting Prometheus/Micrometer metrics for rule execution duration (and logging timing information), so slow-running rules can be identified.

Changes:

  • Add a new openhab.rule.duration timer metric alongside the existing rule run counter.
  • Track rule RUNNING→IDLE transitions to measure execution duration per rule.
  • Rename the event count metric from event_count to event.count.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
bundles/org.openhab.core.io.monitor/.../RuleMetric.java Adds rule-duration timer metric and state tracking for RUNNING/IDLE transitions.
bundles/org.openhab.core.io.monitor/.../EventCountMetric.java Renames the emitted event count metric.
Comments suppressed due to low confidence (1)

bundles/org.openhab.core.io.monitor/src/main/java/org/openhab/core/io/monitor/internal/metrics/RuleMetric.java:39

  • The class Javadoc says this implements a “gauge metric”, but the implementation now publishes a counter and a timer (duration). Please update the Javadoc to reflect the actual metrics emitted (including the new duration metric name), so users know what to expect.
 * The {@link RuleMetric} class implements a gauge metric for rules RUNNING events (per rule)
 *

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Signed-off-by: querdenker2k <querdenker2k@gmx.de>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants