Sumit6307 opened a new pull request, #7984:
URL: https://github.com/apache/incubator-seata/pull/7984
### Ⅰ. Describe what this PR did
Detailed description:
This PR introduces observability metrics to the
[UndoLogManager](cci:2://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/rm-datasource/src/test/java/org/apache/seata/rm/datasource/undo/UndoLogManagerTest.java:36:0-87:1)
in the `rm-datasource` module. 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:
1. **Added Dependency:** Added `seata-metrics-core` to
[rm-datasource/pom.xml](cci:7://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/rm-datasource/pom.xml:0:0-0:0)
to enable metrics recording.
2. **Defined Metrics:** Added new metric definitions in
[UndoLogConstants](cci:2://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/UndoLogConstants.java:25:0-57:1):
* `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.
3. **Instrumentation:** Updated
[AbstractUndoLogManager](cci:2://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/rm-datasource/src/main/java/org/apache/seata/rm/datasource/undo/AbstractUndoLogManager.java:60:0-616:1)
to record these metrics during flush and delete operations.
4. **Verification:** Added
[UndoLogMetricsTest](cci:2://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/rm-datasource/src/test/java/org/apache/seata/rm/datasource/undo/UndoLogMetricsTest.java:28:0-86:1)
to verify the metrics recording logic using Mockito.
### Ⅱ. Does this pull request fix one issue?
<!-- If that, add "fixes #xxx" below in the next line, for example, fixes
#97. -->
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.UndoLogMetricsTest` to verify the metrics
recording logic independently of the database.
### Ⅳ. Describe how to verify it
1. Run the new unit test: `mvn test -pl rm-datasource
-Dtest=UndoLogMetricsTest`
2. In a running Seata environment, enable metrics in `registry.conf`.
3. Execute AT mode transactions.
4. Observe the new metrics (`seata.undo.log.size`,
`seata.undo.log.delete.latency`) in the configured metrics backend (e.g.,
Prometheus).
### Ⅴ. Special notes for reviews
The `seata-metrics-core` dependency was added to `rm-datasource` to access
[RegistryFactory](cci:2://file:///c:/Users/Sumit/OneDrive/Desktop/GSOC_2026/gsoc_incubator-seata/gsoc_incubator-seata/metrics/seata-metrics-core/src/main/java/org/apache/seata/metrics/registry/RegistryFactory.java:32:0-50:1)
and `Id` classes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]