Skip to content

PDO auto-instrumentation reports span.subtype = unknown_DB for Pdo\Pgsql (and other PDO subclasses) on PHP 8.4 #1475

@abelharisov

Description

@abelharisov

Environment

PHP 8.4.19
apm-agent-php 1.15.1
Laravel 13.14.0
PostgreSQL via ext-pdo_pgsql

Describe the bug
After upgrading to PHP 8.4, DB spans in Kibana APM show span.subtype = unknown_DB instead of postgresql. Service Map no longer shows PostgreSQL as a dependency. Redis spans are unaffected.

To Reproduce

  1. PHP 8.4 + ext-pdo_pgsql + apm-agent-php 1.15.1
  2. Run:
$pdo = PDO::connect('pgsql:host=localhost;dbname=test', 'user', 'pass');
$pdo->query('SELECT 1');
  1. Open the resulting DB span in Kibana APM.

Expected behavior
span.subtype = "postgresql", connection visible as PostgreSQL dependency in Service Map.

Actual behavior
span.subtype = "unknown_DB".

Possible cause
PHP 8.4 introduced driver-specific PDO subclasses (RFC) — new PDO('pgsql:...') now returns a Pdo\Pgsql instance instead of plain PDO. The agent hooks PDO methods by the hardcoded class name 'PDO', so the constructor interceptor does not fire on the subclass, the DSN is never parsed, and dbType falls back to unknown_DB. Likely affects all PHP 8.4 PDO subclasses (Pdo\Mysql, Pdo\Sqlite, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions