@@ -75,8 +75,7 @@ public function init()
7575 PDOIntegration::setCommonSpanInfo ($ this , $ span );
7676 $ integration ->addTraceAnalyticsIfEnabled ($ span );
7777
78- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
79- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
78+ PDOIntegration::injectDBIntegration ($ this , $ hook );
8079 }, function (HookData $ hook ) use ($ integration ) {
8180 $ span = $ hook ->span ();
8281 if (is_numeric ($ hook ->returned )) {
@@ -102,8 +101,7 @@ public function init()
102101 PDOIntegration::setCommonSpanInfo ($ this , $ span );
103102 $ integration ->addTraceAnalyticsIfEnabled ($ span );
104103
105- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
106- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
104+ PDOIntegration::injectDBIntegration ($ this , $ hook );
107105 }, function (HookData $ hook ) use ($ integration ) {
108106 $ span = $ hook ->span ();
109107 if ($ hook ->returned instanceof \PDOStatement) {
@@ -122,8 +120,7 @@ public function init()
122120 $ span ->resource = Integration::toString ($ query );
123121 PDOIntegration::setCommonSpanInfo ($ this , $ span );
124122
125- $ driver = $ this ->getAttribute (\PDO ::ATTR_DRIVER_NAME );
126- DatabaseIntegrationHelper::injectDatabaseIntegrationData ($ hook , $ driver );
123+ PDOIntegration::injectDBIntegration ($ this , $ hook );
127124 }, function (HookData $ hook ) use ($ integration ) {
128125 ObjectKVStore::propagate ($ this , $ hook ->returned , PDOIntegration::CONNECTION_TAGS_KEY );
129126 });
@@ -266,12 +263,29 @@ private static function parseDsn($dsn)
266263 case 'port ' :
267264 $ tags [Tag::TARGET_PORT ] = $ value ;
268265 break ;
266+ case 'driver ' :
267+ // This is more specific than just "odbc"
268+ $ tags [Tag::DB_SYSTEM ] = strtolower ($ value );
269+ break ;
269270 }
270271 }
271272
272273 return $ tags ;
273274 }
274275
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+
275289 public static function extractConnectionMetadata (array $ constructorArgs )
276290 {
277291 $ tags = self ::parseDsn ($ constructorArgs [0 ]);
0 commit comments