Open damemi opened 7 months ago
Latest semconv: https://github.com/open-telemetry/semantic-conventions/blob/21b8f4620d2029fe8abb98a4a06655da3232d11d/docs/database/sql.md
Required attributes:
db.collection.name
(“if readily available. The collection name MAY be parsed from the query text, in which case it SHOULD be the first collection name found in the query.”)db.namespace
(“if available”)db.operation.name
(“if readily available. The operation name MAY be parsed from the query text, in which case it SHOULD be the first operation name found in the query.)error.type
(“if and only if the operation failed”)server.port
(If using a port other than the default port for this DBMS and if server.address
is set.Client calls semconv: https://github.com/open-telemetry/semantic-conventions/blob/21b8f4620d2029fe8abb98a4a06655da3232d11d/docs/database/database-spans.md
Name
Database spans MUST follow the overall guidelines for span names.
The span name SHOULD be
{db.operation.name} {target}
if there is a (low-cardinality){db.operation.name}
available (see below for the exact definition of the{target}
placeholder).If there is no (low-cardinality)
db.operation.name
available, database span names SHOULD be{target}
.If neither
{db.operation.name}
nor{target}
are available, span name SHOULD be{db.system}
.Semantic conventions for individual database systems MAY specify different span name format.
The
{target}
SHOULD describe the entity that the operation is performed against and SHOULD adhere to one of the following values, provided they are accessible:
db.collection.name
SHOULD be used for data manipulation operations or operations on database collections.db.namespace
SHOULD be used for operations on a specific database namespace.server.address:server.port
SHOULD be used for other operations not targeting any specific database(s) or collection(s)If a corresponding
{target}
value is not available for a specific operation, the instrumentation SHOULD omit the{target}
. For example, for an operation describing SQL query on an anonymous table likeSELECT * FROM (SELECT * FROM table) t
, span name should beSELECT
.
We currently only set the span name to DB
.
Required attributes (not including common attributes from the previous section):
db.system
db.system
[db.collection.name](http://db.collection.name/)
db.namespace
[db.operation.name](http://db.operation.name/)
error.type
server.port
/ server.address
https://github.com/open-telemetry/semantic-conventions/blob/a04a1f4ba413d0a1f137c223fc243ea14fdcd89b/docs/database/sql.md