feat: add observability metrics for undo log manager#7984
Conversation
…meout - doPostWithHttp2(..., callback, 30) used 30ms timeout; watch holds until event (~2s) - Change to 30000ms to match blocking watch() test so callback runs and latch counts down - Fixes 'expected: <true> but was: <false>' at latch.await(35, TimeUnit.SECONDS)
funky-eyes
left a comment
There was a problem hiding this comment.
I'd appreciate it if you could open a related discussion issue and reach consensus there before submitting a PR, rather than coding first and opening a PR immediately.
@funky-eyes |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #7984 +/- ##
============================================
- Coverage 72.12% 72.09% -0.04%
Complexity 872 872
============================================
Files 1320 1320
Lines 50550 50598 +48
Branches 6026 6033 +7
============================================
+ Hits 36459 36478 +19
- Misses 11101 11113 +12
- Partials 2990 3007 +17
🚀 New features to boost your workflow:
|
|
@funky-eyes Please Review and Merge this PR |
|
@funky-eyes Please Check |
|
@funky-eyes Sir Please Review this PR |
There was a problem hiding this comment.
Pull request overview
This PR adds observability metrics around undo-log generation and deletion in the rm-datasource module, improving visibility into AT-mode undo-log size and delete latency/count.
Changes:
- Add UndoLog metrics
Iddefinitions (summary/timer/counter) inUndoLogConstants. - Instrument undo-log flush and delete (single + batch) paths in
AbstractUndoLogManagerto record metrics. - Add
seata-metrics-coredependency and a Mockito-based unit test verifying metric recording.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java | Records undo-log size and delete latency/count; adds getRegistry() helper for metrics access |
| rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/UndoLogConstants.java | Defines metric Ids for undo-log size and delete timer/counter |
| rm-datasource/src/test/java/org/apache/seata/rm/datasource/undo/UndoLogMetricsTest.java | Adds unit tests verifying metrics are recorded for flush and single delete |
| rm-datasource/pom.xml | Adds seata-metrics-core dependency to enable metrics recording |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @funky-eyes ! Just a quick heads-up outside of the PR review: I am currently submitting my GSoC 2026 proposal for Apache Seata, titled "Enhance Seata Go SDK Multi Registry Support and Seata CTL Diagnostic Tool". I saw FinnTew is listed as a potential mentor. Since you've reviewed most of my recent merged and open PRs, I just wanted to ask if you are also going to be mentoring any GSoC projects this year? Thanks again for all your reviews on my code so far! |
I'm sorry, but due to personal energy constraints, I will not be mentoring any projects this year, including GSoC and OSPP. As for the project you mentioned, a similar one has already been completed in previous OSPP cycles. You can find it in the historical PRs. |
I'm sorry, but due to personal energy constraints, I will not be mentoring any projects this year, including GSoC and OSPP. As for the project you mentioned, a similar one has already been completed in previous OSPP cycles. You can find it in the historical PRs. |
@funky-eyes Hi Sir ,thank you for letting me know, and I completely understand. I really appreciate all the guidance and reviews you've given on my PRs so far. My GSoC project, titled “Enhance Seata-Go Multi-Registry Support and seata-ctl Diagnostic Tool Capability”, is listed as a GSoC 2026 idea. If you’re comfortable, may I share my proposal with you for a quick review? Thanks again for all your support |
@Code-Fight PTAL |
|
Hi @funky-eyes, Thank you for the review and the helpful feedback! I have updated the PR to address all of the comments. Here is a summary of the improvements made:
Please let me know if there are any further adjustments needed or if this is ready to be merged! |
|
@WangzJi Sir please Check this PR |
|
@funky-eyes Sir plz Review this PR |
Ⅰ. Describe what this PR did
Detailed description:
This PR introduces observability metrics to the UndoLogManager in the
rm-datasourcemodule. Currently, there is limited visibility into the size and performance of Undo Log operations, which are critical for the stability and performance of AT mode.The specific changes are:
seata-metrics-coreto rm-datasource/pom.xml to enable metrics recording.seata.undo.log.size(Summary): Tracks the size of generated undo logs.seata.undo.log.delete.latency(Timer): Tracks the latency of undo log deletion operations (both single and batch).seata.undo.log.delete.count(Counter): Tracks the number of delete operations.Ⅱ. Does this pull request fix one issue?
N/A (New Feature / GSoC Contribution)
Ⅲ. Why don't you add test cases (unit test/integration test)?
I have added a new unit test class
org.apache.seata.rm.datasource.undo.UndoLogMetricsTestto verify the metrics recording logic independently of the database.Ⅳ. Describe how to verify it
mvn test -pl rm-datasource -Dtest=UndoLogMetricsTestregistry.conf.seata.undo.log.size,seata.undo.log.delete.latency) in the configured metrics backend (e.g., Prometheus).Ⅴ. Special notes for reviews
The
seata-metrics-coredependency was added torm-datasourceto access RegistryFactory andIdclasses.