Skip to content

Fix executor metrics lifecycle - #321

Merged
liaodn merged 4 commits into
apache:mainfrom
popduke:fix-executor-metrics-lifecycle
Oct 27, 2026
Merged

liaodn merged 4 commits into
apache:mainfrom
popduke:fix-executor-metrics-lifecycle

Conversation

@popduke

@popduke popduke commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

After reviewing #290 and PRs #293 and #320, I found that the problem goes beyond the RocksDB compactor. Other executors also leave meters behind after shutdown, and some pools share the same metric names and tags.

This patch adds MonitoredExecutors to clean up meters on shutdown, which Micrometer's ExecutorServiceMetrics does not do automatically. It also fixes the RocksDB and AgentHost shutdown paths and separates snapshot dump metrics from FSM metrics. Process-wide pools keep their existing monitoring.

Close RocksDB and AgentHost executors and remove their meters.
Remove Raft and range executor meters on shutdown. Release manager
meters before range destruction completes. Keep snapshot dump
metrics under a separate name.

Add tests for shutdown, range split, destruction, and replacement.
Use range tags to give each delay and delivery executor its own meters.
Remove those meters when the owner closes.

Keep DelayTaskRunner.shutdown synchronous. Cancel pending triggers and
wait for the executor to terminate before returning.

Add tests for meter ownership and synchronous shutdown.

@liaodn liaodn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. Approved.

Always stop the test group so later tests can create nodes with the same metric identity.
@liaodn
liaodn merged commit e279da4 into apache:main Oct 27, 2026
4 checks passed
@popduke
popduke deleted the fix-executor-metrics-lifecycle branch October 27, 2026 13:20
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.

2 participants