Open reftel opened 6 years ago
That's expected. What change are you suggesting we make?
Well, I see three options: either
simpleclient_hibernate
, which supports only 5.2.0 and above, and simpleclient_hibernate4
, which does not provide the metric), orI can do a PR for either of them if needed.
This is already a setting that you explicitly have to enable in your code, and the pom already states the dependency.
I guess I wasn't clear in option 3. I meant checking using introspection whether the hibernate_per_query_execution_seconds_total
metric should be added (and then fetching it in a roundabout way, e.g. introspection or dynamically loaded or generated code).
As for the pom, the comment by the hibernate dependency states "We support Hibernate versions >= 4.2". If the intention is to not support per-query metrics in versions before 5.2.0, then the comment should probably make that clear. "We support Hibernate versions >= 4.2, with per-query metrics in versions >= 5.2", or something like that?
Ah, that comment was missed in code review. It should say 5.2.0 now.
The comment still says "We support Hibernate versions >= 4.2": https://github.com/prometheus/client_java/blob/main/simpleclient_hibernate/pom.xml#L43
If per-query metrics is enabled and Hibernate 4.2.0.Final is used (which, according to
simpleclient_hibernate/pom.xml
, is supported),HibernateStatisticsCollector
fails due with an exception:java.lang.NoSuchMethodError: org.hibernate.stat.QueryStatistics.getExecutionTotalTime()
, since that method was not added until version 5.2.0.