@@ -602,7 +602,7 @@ func TestTx_Query(t *testing.T) {
602602 mock .ExpectQuery ("SELECT 1" ).
603603 WillReturnRows (sqlmock .NewRows ([]string {"1" }).AddRow ("1" ))
604604 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
605- gomock .Any ())
605+ gomock .Any (), "type" , "SELECT" )
606606
607607 rows , err = tx .Query ("SELECT 1" )
608608 assert .Nil (t , err )
@@ -632,7 +632,7 @@ func TestTx_QueryError(t *testing.T) {
632632 mock .ExpectQuery ("SELECT " ).
633633 WillReturnError (errSyntax )
634634 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
635- gomock .Any ())
635+ gomock .Any (), "type" , "SELECT" )
636636
637637 rows , err = tx .Query ("SELECT" )
638638 if ! assert .Nil (t , rows ) {
@@ -665,7 +665,7 @@ func TestTx_QueryRow(t *testing.T) {
665665 mock .ExpectQuery ("SELECT name FROM employee WHERE id = ?" ).WithArgs (1 ).
666666 WillReturnRows (sqlmock .NewRows ([]string {"name" }).AddRow ("jhon" ))
667667 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
668- gomock .Any ())
668+ gomock .Any (), "type" , "SELECT" )
669669
670670 row = tx .QueryRow ("SELECT name FROM employee WHERE id = ?" , 1 )
671671 assert .NotNil (t , row )
@@ -692,7 +692,7 @@ func TestTx_QueryRowContext(t *testing.T) {
692692
693693 mock .ExpectQuery ("SELECT name FROM employee WHERE id = ?" ).WithArgs (1 )
694694 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
695- gomock .Any ())
695+ gomock .Any (), "type" , "SELECT" )
696696
697697 row = tx .QueryRowContext (context .Background (), "SELECT name FROM employee WHERE id = ?" , 1 )
698698 assert .NotNil (t , row )
@@ -721,7 +721,7 @@ func TestTx_Exec(t *testing.T) {
721721 mock .ExpectExec ("INSERT INTO employee VALUES(?, ?)" ).
722722 WithArgs (2 , "doe" ).WillReturnResult (sqlmock .NewResult (1 , 1 ))
723723 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
724- gomock .Any ())
724+ gomock .Any (), "type" , "INSERT" )
725725
726726 res , err = tx .Exec ("INSERT INTO employee VALUES(?, ?)" , 2 , "doe" )
727727 assert .Nil (t , err )
@@ -751,7 +751,7 @@ func TestTx_ExecError(t *testing.T) {
751751 mock .ExpectExec ("INSERT INTO employee VALUES(?, ?" ).
752752 WithArgs (2 , "doe" ).WillReturnError (errSyntax )
753753 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
754- gomock .Any ())
754+ gomock .Any (), "type" , "INSERT" )
755755
756756 res , err = tx .Exec ("INSERT INTO employee VALUES(?, ?" , 2 , "doe" )
757757 assert .Nil (t , res )
@@ -782,7 +782,7 @@ func TestTx_ExecContext(t *testing.T) {
782782 mock .ExpectExec (`INSERT INTO employee VALUES(?, ?)` ).
783783 WithArgs (2 , "doe" ).WillReturnResult (sqlmock .NewResult (1 , 1 ))
784784 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
785- gomock .Any ())
785+ gomock .Any (), "type" , "INSERT" )
786786
787787 res , err = tx .ExecContext (context .Background (), "INSERT INTO employee VALUES(?, ?)" , 2 , "doe" )
788788 assert .Nil (t , err )
@@ -812,7 +812,7 @@ func TestTx_ExecContextError(t *testing.T) {
812812 mock .ExpectExec (`INSERT INTO employee VALUES(?, ?)` ).
813813 WithArgs (2 , "doe" ).WillReturnResult (sqlmock .NewResult (1 , 1 ))
814814 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
815- gomock .Any ())
815+ gomock .Any (), "type" , "INSERT" )
816816
817817 res , err = tx .ExecContext (context .Background (), "INSERT INTO employee VALUES(?, ?)" , 2 , "doe" )
818818 assert .Nil (t , err )
@@ -841,7 +841,7 @@ func TestTx_Prepare(t *testing.T) {
841841
842842 mock .ExpectPrepare ("SELECT name FROM employee WHERE id = ?" )
843843 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
844- gomock .Any ())
844+ gomock .Any (), "type" , "SELECT" )
845845
846846 stmt , err = tx .Prepare ("SELECT name FROM employee WHERE id = ?" )
847847 assert .Nil (t , err )
@@ -870,7 +870,7 @@ func TestTx_PrepareError(t *testing.T) {
870870
871871 mock .ExpectPrepare ("SELECT name FROM employee WHERE id = ?" )
872872 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
873- gomock .Any ())
873+ gomock .Any (), "type" , "SELECT" )
874874
875875 stmt , err = tx .Prepare ("SELECT name FROM employee WHERE id = ?" )
876876 assert .Nil (t , err )
@@ -894,7 +894,7 @@ func TestTx_Commit(t *testing.T) {
894894 tx := getTransaction (db , mock )
895895
896896 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
897- gomock .Any ())
897+ gomock .Any (), "type" , "COMMIT" )
898898 mock .ExpectCommit ()
899899
900900 err = tx .Commit ()
@@ -918,7 +918,7 @@ func TestTx_CommitError(t *testing.T) {
918918 tx := getTransaction (db , mock )
919919
920920 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
921- gomock .Any ())
921+ gomock .Any (), "type" , "COMMIT" )
922922 mock .ExpectCommit ().WillReturnError (errDB )
923923
924924 err = tx .Commit ()
@@ -943,7 +943,7 @@ func TestTx_RollBack(t *testing.T) {
943943 tx := getTransaction (db , mock )
944944
945945 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
946- gomock .Any ())
946+ gomock .Any (), "type" , "ROLLBACK" )
947947 mock .ExpectRollback ()
948948
949949 err = tx .Rollback ()
@@ -967,7 +967,7 @@ func TestTx_RollbackError(t *testing.T) {
967967 tx := getTransaction (db , mock )
968968
969969 mockMetrics .EXPECT ().RecordHistogram (gomock .Any (), "app_sql_stats" ,
970- gomock .Any ())
970+ gomock .Any (), "type" , "ROLLBACK" )
971971 mock .ExpectRollback ().WillReturnError (errDB )
972972
973973 err = tx .Rollback ()
0 commit comments