@@ -75,8 +75,7 @@ public function init()
75
75
PDOIntegration::setCommonSpanInfo ($ this , $ span );
76
76
$ integration ->addTraceAnalyticsIfEnabled ($ span );
77
77
78
- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
79
- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
78
+ PDOIntegration::injectDBIntegration ($ this , $ hook );
80
79
}, function (HookData $ hook ) use ($ integration ) {
81
80
$ span = $ hook ->span ();
82
81
if (is_numeric ($ hook ->returned )) {
@@ -102,8 +101,7 @@ public function init()
102
101
PDOIntegration::setCommonSpanInfo ($ this , $ span );
103
102
$ integration ->addTraceAnalyticsIfEnabled ($ span );
104
103
105
- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
106
- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
104
+ PDOIntegration::injectDBIntegration ($ this , $ hook );
107
105
}, function (HookData $ hook ) use ($ integration ) {
108
106
$ span = $ hook ->span ();
109
107
if ($ hook ->returned instanceof \PDOStatement) {
@@ -122,8 +120,7 @@ public function init()
122
120
$ span ->resource = Integration::toString ($ query );
123
121
PDOIntegration::setCommonSpanInfo ($ this , $ span );
124
122
125
- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
126
- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
123
+ PDOIntegration::injectDBIntegration ($ this , $ hook );
127
124
}, function (HookData $ hook ) use ($ integration ) {
128
125
ObjectKVStore::propagate ($ this , $ hook ->returned , PDOIntegration::CONNECTION_TAGS_KEY );
129
126
});
@@ -266,12 +263,29 @@ private static function parseDsn($dsn)
266
263
case 'port ' :
267
264
$ tags [Tag::TARGET_PORT ] = $ value ;
268
265
break ;
266
+ case 'driver ' :
267
+ // This is more specific than just "odbc"
268
+ $ tags [Tag::DB_SYSTEM ] = strtolower ($ value );
269
+ break ;
269
270
}
270
271
}
271
272
272
273
return $ tags ;
273
274
}
274
275
276
+ private static function injectDBIntegration ($ pdo , $ hook )
277
+ {
278
+ $ driver = $ pdo ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
279
+ if ($ driver === "odbc " ) {
280
+ $ cached_driver = ObjectKVStore::get ($ pdo , PDOIntegration::CONNECTION_TAGS_KEY , []);
281
+ // This particular driver is not supported for DBM
282
+ if (isset ($ cached_driver [Tag::DB_SYSTEM ]) && $ cached_driver [Tag::DB_SYSTEM ] === "ingres " ) {
283
+ return ;
284
+ }
285
+ }
286
+ DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
287
+ }
288
+
275
289
public static function extractConnectionMetadata (array $ constructorArgs )
276
290
{
277
291
$ tags = self ::parseDsn ($ constructorArgs [0 ]);
0 commit comments