Closed ieatlettuce closed 1 year ago
What I see in prometheus metrics
jdbc_query_seconds_max{error="none",} 113.698347232
What I want to see
jdbc_query_seconds_max{error="none",query="select * from user where name=?;"} 113.698347232
I've gone through documentation and code and were not able to identify the place I could inject custom tags or configure it to include SQL template.
I can do totally custom using QueryExecutionListener.afterQuery, but then I'll have two very similar metrics.
QueryExecutionListener.afterQuery
Hi @ieatlettuce You can create an ObservationHandler that reacts to the QueryContext. In the handler, you can create a meter and add the queries as a tag.
ObservationHandler
QueryContext
What I see in prometheus metrics
What I want to see
I've gone through documentation and code and were not able to identify the place I could inject custom tags or configure it to include SQL template.
I can do totally custom using
QueryExecutionListener.afterQuery
, but then I'll have two very similar metrics.