@@ -98,7 +98,7 @@ public function collect()
98
98
);
99
99
100
100
foreach ($ this ->connections as $ name => $ pdo ) {
101
- $ pdodata = $ this ->collectPDO ($ pdo , $ this ->timeCollector );
101
+ $ pdodata = $ this ->collectPDO ($ pdo , $ this ->timeCollector , $ name );
102
102
$ data ['nb_statements ' ] += $ pdodata ['nb_statements ' ];
103
103
$ data ['nb_failed_statements ' ] += $ pdodata ['nb_failed_statements ' ];
104
104
$ data ['accumulated_duration ' ] += $ pdodata ['accumulated_duration ' ];
@@ -120,10 +120,16 @@ public function collect()
120
120
*
121
121
* @param TraceablePDO $pdo
122
122
* @param TimeDataCollector $timeCollector
123
+ * @param string|null $connectionName the pdo connection (eg default | read | write)
123
124
* @return array
124
125
*/
125
- protected function collectPDO (TraceablePDO $ pdo , TimeDataCollector $ timeCollector = null )
126
+ protected function collectPDO (TraceablePDO $ pdo , TimeDataCollector $ timeCollector = null , $ connectionName = null )
126
127
{
128
+ if (empty ($ connectionName ) || $ connectionName == 'default ' ) {
129
+ $ connectionName = 'pdo ' ;
130
+ } else {
131
+ $ connectionName = 'pdo ' . $ connectionName ;
132
+ }
127
133
$ stmts = array ();
128
134
foreach ($ pdo ->getExecutedStatements () as $ stmt ) {
129
135
$ stmts [] = array (
@@ -143,7 +149,7 @@ protected function collectPDO(TraceablePDO $pdo, TimeDataCollector $timeCollecto
143
149
'error_message ' => $ stmt ->getErrorMessage ()
144
150
);
145
151
if ($ timeCollector !== null ) {
146
- $ timeCollector ->addMeasure ($ stmt ->getSql (), $ stmt ->getStartTime (), $ stmt ->getEndTime ());
152
+ $ timeCollector ->addMeasure ($ stmt ->getSql (), $ stmt ->getStartTime (), $ stmt ->getEndTime (), array (), $ connectionName );
147
153
}
148
154
}
149
155
0 commit comments