Developer Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Tracing SQL Queries with the X-Ray SDK for Go

To trace SQL calls to PostgreSQL or MySQL, replacing sql.Open calls to xray.SQL, as shown in the following example. Use URLs instead of configuration strings if possible.

Example main.go

func main() { db := xray.SQL("postgres", "postgres://user:password@host:port/db") row, _ := db.QueryRow("SELECT 1") // Use as normal }