Working with databases
With auto-instrumentation, spans for database calls are created and attributes are filled automatically. If using manual instrumentation, follow the conventions described below.
Naming convention
The span name has the <db.operation> <db.name>.<db.sql.table> format, e.g., SELECT shop.orders. If any of the components is not available, you can omit it: SELECT shop, SELECT orders. For more information, see the database span naming specification
Attributes
|
Attribute |
Description |
|
|
DBMS type: |
|
|
Database name |
|
|
Operation: |
|
|
Table name |
|
|
Query text |
|
|
Database username |
|
|
Connection string |
|
|
Host name or IP address of the database server |
|
|
Database server port |
Warning
The db.statement attribute may contain sensitive data. Ensure that queries do not include passwords, tokens, or any personally identifiable information in plaintext.
Example
order-service runs a query to the MySQL database:
|
Attribute |
Value |
|
Name |
|
|
Kind |
|
|
Status |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|