7
7
use Doctrine \DBAL \Connection ;
8
8
use Doctrine \DBAL \Jaeger \Tag \DbalAutoCommitTag ;
9
9
use Doctrine \DBAL \Jaeger \Tag \DbalErrorCodeTag ;
10
+ use Doctrine \DBAL \Jaeger \Tag \DbalNestingLevelTag ;
10
11
use Doctrine \DBAL \Jaeger \Tag \DbalRowNumberTag ;
11
12
use Jaeger \Tag \DbInstanceTag ;
12
13
use Jaeger \Tag \DbStatementTag ;
@@ -32,7 +33,8 @@ public function connect()
32
33
->addTag (new DbInstanceTag ($ this ->getDatabase ()))
33
34
->addTag (new DbUser ($ this ->getUsername ()))
34
35
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
35
- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
36
+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
37
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
36
38
try {
37
39
parent ::connect ();
38
40
} catch (\Exception $ e ) {
@@ -52,7 +54,8 @@ public function prepare($prepareString)
52
54
->addTag (new DbUser ($ this ->getUsername ()))
53
55
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
54
56
->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
55
- ->addTag (new DbStatementTag ($ prepareString ));
57
+ ->addTag (new DbStatementTag ($ prepareString ))
58
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
56
59
try {
57
60
return parent ::prepare ($ prepareString );
58
61
} catch (\Exception $ e ) {
@@ -72,7 +75,8 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
72
75
->addTag (new DbUser ($ this ->getUsername ()))
73
76
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
74
77
->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
75
- ->addTag (new DbStatementTag ($ query ));
78
+ ->addTag (new DbStatementTag ($ query ))
79
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
76
80
try {
77
81
return parent ::executeQuery ($ query , $ params , $ types , $ qcp );
78
82
} catch (\Exception $ e ) {
@@ -92,7 +96,8 @@ public function executeUpdate($query, array $params = [], array $types = [])
92
96
->addTag (new DbUser ($ this ->getUsername ()))
93
97
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
94
98
->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
95
- ->addTag (new DbStatementTag ($ query ));
99
+ ->addTag (new DbStatementTag ($ query ))
100
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
96
101
try {
97
102
return parent ::executeUpdate ($ query , $ params , $ types );
98
103
} catch (\Exception $ e ) {
@@ -111,7 +116,8 @@ public function query()
111
116
->addTag (new DbInstanceTag ($ this ->getDatabase ()))
112
117
->addTag (new DbUser ($ this ->getUsername ()))
113
118
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
114
- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
119
+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
120
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
115
121
try {
116
122
return parent ::query ();
117
123
} catch (\Exception $ e ) {
@@ -130,7 +136,8 @@ public function exec($statement)
130
136
->addTag (new DbInstanceTag ($ this ->getDatabase ()))
131
137
->addTag (new DbUser ($ this ->getUsername ()))
132
138
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
133
- ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()));
139
+ ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
140
+ ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
134
141
try {
135
142
$ rows = parent ::exec ($ statement );
136
143
$ span ->addTag (new DbalRowNumberTag ($ rows ));
@@ -160,7 +167,7 @@ public function beginTransaction()
160
167
->addTag (new ErrorTag ());
161
168
throw $ e ;
162
169
} finally {
163
- $ this ->tracer ->finish ($ span );
170
+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
164
171
}
165
172
}
166
173
@@ -179,7 +186,7 @@ public function commit()
179
186
->addTag (new ErrorTag ());
180
187
throw $ e ;
181
188
} finally {
182
- $ this ->tracer ->finish ($ span );
189
+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
183
190
}
184
191
}
185
192
@@ -198,7 +205,7 @@ public function rollBack()
198
205
->addTag (new ErrorTag ());
199
206
throw $ e ;
200
207
} finally {
201
- $ this ->tracer ->finish ($ span );
208
+ $ this ->tracer ->finish ($ span-> addTag ( new DbalNestingLevelTag ( $ this -> getTransactionNestingLevel ())) );
202
209
}
203
210
}
204
211
}
0 commit comments