Skip to content

v1.3.0

Compare
Choose a tag to compare
@yvardhineni yvardhineni released this 19 Jun 18:39
· 8 commits to main since this release
09c77f9
feat: Add Prometheus metric to track sql stmts per transaction (#29)

* Added a new summary metric `transaction_sql_stmts` to track the number of exec/querys stmts executed per transaction
* Introduced a new struct `managedTx` to to hold the context and connection of a transaction
* Introduced a new field `execStmtsCounter` and `queryStmtsCounter` in the `managedConn` to track the number of exec querys in a transaction
* When SQL lib opens a transaction we are storing the connection for that transaction and context of the transaction in the `managedTx`
* Context is used to store the required grpc labels for the metric. i.e. grpc method, grpc service
* Added a UnaryInterceptor to the grpc server to store the grpc method and grpc service in the context
* On commit or rollback of the transaction we are removing the connection from the `managedTx` and resetting the counters to 0
* On commit of the transaction we are observing the `transaction_sql_stmts` metric by the number of exec/querys got executed in the transaction