-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
a9750df
commit 09c77f9
Showing
9 changed files
with
394 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.