77use Doctrine \DBAL \Connection ;
88use Doctrine \DBAL \Jaeger \Tag \DbalAutoCommitTag ;
99use Doctrine \DBAL \Jaeger \Tag \DbalErrorCodeTag ;
10+ use Doctrine \DBAL \Jaeger \Tag \DbalNestingLevelTag ;
1011use Doctrine \DBAL \Jaeger \Tag \DbalRowNumberTag ;
1112use Jaeger \Tag \DbInstanceTag ;
1213use Jaeger \Tag \DbStatementTag ;
@@ -32,7 +33,8 @@ public function connect()
3233 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
3334 ->addTag (new DbUser ($ this ->getUsername ()))
3435 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
35- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
36+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
37+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
3638 try {
3739 parent ::connect ();
3840 } catch (\Exception $ e ) {
@@ -52,7 +54,8 @@ public function prepare($prepareString)
5254 ->addTag (new DbUser ($ this ->getUsername ()))
5355 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
5456 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
55- ->addTag (new DbStatementTag ($ prepareString ));
57+ ->addTag (new DbStatementTag ($ prepareString ))
58+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
5659 try {
5760 return parent ::prepare ($ prepareString );
5861 } catch (\Exception $ e ) {
@@ -72,7 +75,8 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
7275 ->addTag (new DbUser ($ this ->getUsername ()))
7376 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
7477 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
75- ->addTag (new DbStatementTag ($ query ));
78+ ->addTag (new DbStatementTag ($ query ))
79+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
7680 try {
7781 return parent ::executeQuery ($ query , $ params , $ types , $ qcp );
7882 } catch (\Exception $ e ) {
@@ -92,7 +96,8 @@ public function executeUpdate($query, array $params = [], array $types = [])
9296 ->addTag (new DbUser ($ this ->getUsername ()))
9397 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
9498 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
95- ->addTag (new DbStatementTag ($ query ));
99+ ->addTag (new DbStatementTag ($ query ))
100+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
96101 try {
97102 return parent ::executeUpdate ($ query , $ params , $ types );
98103 } catch (\Exception $ e ) {
@@ -111,7 +116,8 @@ public function query()
111116 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
112117 ->addTag (new DbUser ($ this ->getUsername ()))
113118 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
114- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
119+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
120+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
115121 try {
116122 return parent ::query ();
117123 } catch (\Exception $ e ) {
@@ -130,7 +136,8 @@ public function exec($statement)
130136 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
131137 ->addTag (new DbUser ($ this ->getUsername ()))
132138 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
133- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
139+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
140+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
134141 try {
135142 $ rows = parent ::exec ($ statement );
136143 $ span ->addTag (new DbalRowNumberTag ($ rows ));
@@ -160,7 +167,7 @@ public function beginTransaction()
160167 ->addTag (new ErrorTag ());
161168 throw $ e ;
162169 } finally {
163- $ this ->tracer ->finish ($ span );
170+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
164171 }
165172 }
166173
@@ -179,7 +186,7 @@ public function commit()
179186 ->addTag (new ErrorTag ());
180187 throw $ e ;
181188 } finally {
182- $ this ->tracer ->finish ($ span );
189+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
183190 }
184191 }
185192
@@ -198,7 +205,7 @@ public function rollBack()
198205 ->addTag (new ErrorTag ());
199206 throw $ e ;
200207 } finally {
201- $ this ->tracer ->finish ($ span );
208+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
202209 }
203210 }
204211}
0 commit comments