OpenTelemetry PHP

DbAttributes

Semantic attributes and corresponding values for db.

Tags
see
https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/

Table of Contents

Constants

DB_COLLECTION_NAME  : mixed = 'db.collection.name'
The name of a collection (table, container) within the database.
DB_NAMESPACE  : mixed = 'db.namespace'
The name of the database, fully qualified within the server address and port.
DB_OPERATION_BATCH_SIZE  : mixed = 'db.operation.batch.size'
The number of database operations included in a batch operation.
DB_OPERATION_NAME  : mixed = 'db.operation.name'
The name of the operation or command being executed.
DB_QUERY_SUMMARY  : mixed = 'db.query.summary'
Low cardinality summary of a database query.
DB_QUERY_TEXT  : mixed = 'db.query.text'
The database query being executed.
DB_RESPONSE_STATUS_CODE  : mixed = 'db.response.status_code'
Database response status code.
DB_STORED_PROCEDURE_NAME  : mixed = 'db.stored_procedure.name'
The name of a stored procedure within the database.
DB_SYSTEM_NAME  : mixed = 'db.system.name'
The database management system (DBMS) product as identified by the client instrumentation.
DB_SYSTEM_NAME_VALUE_MARIADB  : mixed = 'mariadb'
[MariaDB](https://mariadb.org/)
DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER  : mixed = 'microsoft.sql_server'
[Microsoft SQL Server](https://www.microsoft.com/sql-server)
DB_SYSTEM_NAME_VALUE_MYSQL  : mixed = 'mysql'
[MySQL](https://www.mysql.com/)
DB_SYSTEM_NAME_VALUE_POSTGRESQL  : mixed = 'postgresql'
[PostgreSQL](https://www.postgresql.org/)

Constants

DB_COLLECTION_NAME

The name of a collection (table, container) within the database.

public mixed DB_COLLECTION_NAME = 'db.collection.name'

It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

The collection name SHOULD NOT be extracted from db.query.text, when the database system supports query text with multiple collections in non-batch operations.

For batch operations, if the individual operations would all have the same db.collection.name when executed as non-batch operations, then that collection name SHOULD be used.

Tags
stable

DB_NAMESPACE

The name of the database, fully qualified within the server address and port.

public mixed DB_NAMESPACE = 'db.namespace'

If a database system has multiple namespace components, they SHOULD be concatenated from the most general to the most specific namespace component, using | as a separator between the components. Any missing components (and their associated separators) SHOULD be omitted. Semantic conventions for individual database systems SHOULD document what db.namespace means in the context of that system. It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

Tags
stable

DB_OPERATION_BATCH_SIZE

The number of database operations included in a batch operation.

public mixed DB_OPERATION_BATCH_SIZE = 'db.operation.batch.size'

Except for empty batch requests described below, a batch operation contains two or more database operations explicitly submitted as separate operations in a single client call, protocol message, or database command.

Requests to batch APIs that contain only one operation SHOULD be modeled as single operations, not as batch operations.

A database call is not a batch operation solely because one operation accepts multiple operands, such as keys, rows, documents, points, or other data elements, including Redis MGET with multiple keys.

In batch APIs that execute the same parameterized operation with parameter sets, each parameter set represents one database operation for determining whether the request is a batch operation. Requests with only one parameter set SHOULD be modeled as single operations, not as batch operations.

db.operation.batch.size SHOULD be set to the number of operations in the batch. It SHOULD NOT be set for non-batch operations.

A request to execute a batch operation with no operations SHOULD also be treated as a batch operation, and db.operation.batch.size SHOULD be set to 0.

Tags
stable

DB_OPERATION_NAME

The name of the operation or command being executed.

public mixed DB_OPERATION_NAME = 'db.operation.name'

It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

The operation name SHOULD NOT be extracted from db.query.text, when the database system supports query text with multiple operations in non-batch operations.

If spaces can occur in the operation name, multiple consecutive spaces SHOULD be normalized to a single space.

For batch operations, if the individual operations would all have the same db.operation.name when executed as non-batch operations, then that operation name SHOULD be used prepended by BATCH . Otherwise, db.operation.name SHOULD be BATCH or some other database system specific term if more applicable.

Tags
stable

DB_QUERY_SUMMARY

Low cardinality summary of a database query.

public mixed DB_QUERY_SUMMARY = 'db.query.summary'

The query summary describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries.

Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following Generating query summary section.

For batch operations, if the individual operations would all have the same db.query.summary when executed as non-batch operations, then that query summary SHOULD be used prepended by BATCH . Otherwise, db.query.summary SHOULD be BATCH or some other database system specific term if more applicable.

Tags
stable

DB_QUERY_TEXT

The database query being executed.

public mixed DB_QUERY_TEXT = 'db.query.text'

For sanitization see Sanitization of db.query.text. For batch operations, if the individual operations would all have the same db.query.text when executed as non-batch operations, then that query text SHOULD be used. Otherwise, all of the individual query texts SHOULD be concatenated with separator ; or some other database system specific separator if more applicable. Parameterized query text SHOULD NOT be sanitized. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk.

Tags
stable

DB_RESPONSE_STATUS_CODE

Database response status code.

public mixed DB_RESPONSE_STATUS_CODE = 'db.response.status_code'

The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes. The value MAY use a standardized string representation of a numeric status code, if one exists, instead of the numeric code. The value MAY be a synthetic status provided by the client library rather than returned by the remote service. Semantic conventions for individual database systems SHOULD document what db.response.status_code means in the context of that system.

Tags
stable

DB_STORED_PROCEDURE_NAME

The name of a stored procedure within the database.

public mixed DB_STORED_PROCEDURE_NAME = 'db.stored_procedure.name'

It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

For batch operations, if the individual operations would all have the same db.stored_procedure.name when executed as non-batch operations, then that stored procedure name SHOULD be used.

Tags
stable

DB_SYSTEM_NAME

The database management system (DBMS) product as identified by the client instrumentation.

public mixed DB_SYSTEM_NAME = 'db.system.name'

The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the db.system.name is set to postgresql based on the instrumentation's best knowledge.

Tags
stable

DB_SYSTEM_NAME_VALUE_MARIADB

[MariaDB](https://mariadb.org/)

public mixed DB_SYSTEM_NAME_VALUE_MARIADB = 'mariadb'
Tags
stable

DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER

[Microsoft SQL Server](https://www.microsoft.com/sql-server)

public mixed DB_SYSTEM_NAME_VALUE_MICROSOFT_SQL_SERVER = 'microsoft.sql_server'
Tags
stable

DB_SYSTEM_NAME_VALUE_MYSQL

[MySQL](https://www.mysql.com/)

public mixed DB_SYSTEM_NAME_VALUE_MYSQL = 'mysql'
Tags
stable

DB_SYSTEM_NAME_VALUE_POSTGRESQL

[PostgreSQL](https://www.postgresql.org/)

public mixed DB_SYSTEM_NAME_VALUE_POSTGRESQL = 'postgresql'
Tags
stable
On this page

Search results