HHH-20783 Add a dedicated failed-transactions counter to Statistics - #13206
Open
pjs7678 wants to merge 1 commit into
Open
HHH-20783 Add a dedicated failed-transactions counter to Statistics#13206pjs7678 wants to merge 1 commit into
pjs7678 wants to merge 1 commit into
Conversation
|
Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated. |
beikov
requested changes
Aug 18, 2026
beikov
left a comment
Member
There was a problem hiding this comment.
Please add a section to Statistics.adoc that is similar to the one for getSuccessfulTransactionCount(). As for the test, it's IMO fine to just add asserts to CMTTest and StatelessSessionStatisticsTest analogous to what has been done for getSuccessfulTransactionCount()
Author
|
Thanks! Both addressed: documented |
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



https://hibernate.atlassian.net/browse/HHH-20783
The failed-transactions value exposed by hibernate-micrometer as hibernate.transactions{result="failure"} was derived as
getTransactionCount() - getSuccessfulTransactionCount(). Since endTransaction() increments the two counters non-atomically, a concurrent reader (e.g. a Prometheus scrape) could transiently observe a negative value - and Micrometer 1.14+ (Prometheus Java client 1.x) rejects negative counters, failing the entire /actuator/prometheus scrape with HTTP 500.
As suggested by Christian Beikov on the forum (https://discourse.hibernate.org/t/12391), this introduces a dedicated counter:
Includes a regression test (deterministic success/rollback/clear cases plus a short concurrency guard). A standalone reproducer against the old derivation is attached to the Jira ticket (observes ~31k negative reads within 10 seconds on 6.6.55.Final).
Please make sure that the following tasks are completed:
Tasks specific to HHH-20783 (Bug):
migration-guide.adocOR check there are no breaking changesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.