aws-otel-php icon indicating copy to clipboard operation
aws-otel-php copied to clipboard

Recording SQL statements in traces for X-Ray

Open sc0ttdav3y opened this issue 1 year ago • 2 comments

Hi again,

I've been reading that X-Ray has a dedicated set of annotation fields for tracing SQL: https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-sql

I'm connecting a PHP app to an RDS Aurora (MySQL) database and I'd like to trace the SQL calls, and ideally see RDS as a node in the service map.

I currently have my SQL statements added as standard annotations, however ideallyI could use the x-ray sql segment fields, and ideally that would show RDS as a node in X-Ray.

I'm currently just doing this:

$span->setAttributes(['sql' => $query, 'params' => $params]);

It works, but I don't get any sort of visibility into DB usage, load, etc.

Not sure if this is a supported feature I've missed, or a feature request for future.

Thanks, Scott

sc0ttdav3y avatar Jan 28 '23 09:01 sc0ttdav3y