-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Expose Hibernate Statistics #3596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Any thoughts on adding this to Spring Boot (or the quality of the request :) ) |
I've been thinking of that one lately. Have you tried with Hibernate 5? This also exposes only the stats if one primary |
This has been tested with Hibernate 4.3.10 not Hibernate 5 . I'll take a look at on how to refactor it for multiple persistence units, shouldn't be that difficult (I'll take a peek at the I have been thinking of making it also a bit more generic so that support for EclipseLink (for instance) could be added. Just like the metrics support for |
Any thoughts on the updated code? |
I am afraid I am personally out of cycles to look at this at the moment. The fact I have no indication it works with Hibernate 5 is also a reason. |
I can run the tests against both Hibernate 4.3 and Hibernate 5. Is there an easy way to do that with the current build? Override the version for hibernate? |
A validation that it does work with Hibernate 5 is already good on its own. I haven't figured out yet how we'll integrate integration testing for Hibernate 5. Probably a dedicated sample (see #2763) |
@mdeinum can you rebase your PR and make sure it works still? Thanks! |
@snicoll Rebased and fixed some of the new check style rules (tabs instead of spaces, copyright header etc.). Tests still green after this. |
@snicoll I did some polishing as there where still some check style errors. |
Is there any chance this will board Spring Boot? |
@Bert-R there is a milestone version attached to it and I intend to honour it. So, yes. Maybe not in its current form though. There are a lot of stats there. |
@snicoll Great, thanks a lot! |
@snicoll anything I can do to polish this up? Good start would probably be to make it work with boot 2.0.0 (maybe we can have a chat about it during SpringIO (?) ) |
Of course! |
Ok. My rebase skills are seriously lacking today... I guess we can consider this pull request dead... I'll create a new one. |
@mdeinum You can force push, no need to close it |
That is what I figured, after the fact. Squashed the commits and did a force push. That cleaned up things... |
When hibernate is on the classpath and one or more `EntityManagerFactory` are configured then register a `HibernatePublicMetrics` bean so that the statistics from hibernate get published to the metrics endpoint. The exposed statistics are the same as those that would be exposed using `Statistics.logSummary`from hibernate itself.
@@ -138,6 +138,11 @@ | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.hibernate</groupId> | |||
<artifactId>hibernate-entitymanager</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we are intending to include in spring boot 2.0 and spring boot 2.0 supports Hibernate 5.2+ , Since 5.2 entitymanager module is integrated with core module. this dependency is not necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rajadileepkolli that PR hasn't been reviewed in the target branch yet. We'll take care of that at that time.
With the move to micrometer, I am afraid this PR can't be merged. I'd advise to discuss with the micrometer team to see if how this can be added. |
When hibernate is on the classpath and an
EntityManagerFactory
is configured thenregister a
HibernateMetrics
bean so that the statistics from hibernate get publishedto the metrics endpoint.
The exposed statistics are the same as those that would be exposed using
Statistics.logSummary
from hibernate itself.
Issue: #2157