Skip to content

Commit

Permalink
Mark sampling relevant database attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Jun 19, 2024
1 parent cde003c commit 6e160b3
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 8 deletions.
10 changes: 10 additions & 0 deletions docs/database/cassandra.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`db.cassandra.consistency_level` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
10 changes: 10 additions & 0 deletions docs/database/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`db.cosmosdb.connection_mode` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
8 changes: 8 additions & 0 deletions docs/database/couchdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ described on this page.



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
11 changes: 11 additions & 0 deletions docs/database/database-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`db.system`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`db.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
12 changes: 12 additions & 0 deletions docs/database/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`http.request.method`](/docs/attributes-registry/http.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)
* [`url.full`](/docs/attributes-registry/url.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
9 changes: 9 additions & 0 deletions docs/database/hbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ For batch operations, if the individual operations are known to have the same op



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
9 changes: 9 additions & 0 deletions docs/database/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ For batch operations, if the individual operations are known to have the same co



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
10 changes: 10 additions & 0 deletions docs/database/mssql.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
9 changes: 9 additions & 0 deletions docs/database/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.namespace`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
9 changes: 9 additions & 0 deletions docs/database/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ If a parameter has no name and instead is referenced only by index, then `<key>`



The following attributes can be important for making sampling decisions
and SHOULD be provided **at span creation time** (if provided at all):

* [`db.collection.name`](/docs/attributes-registry/db.md)
* [`db.operation.name`](/docs/attributes-registry/db.md)
* [`db.query.text`](/docs/attributes-registry/db.md)
* [`server.address`](/docs/attributes-registry/server.md)
* [`server.port`](/docs/attributes-registry/server.md)

`error.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
Expand Down
48 changes: 40 additions & 8 deletions model/trace/database.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
groups:
- id: trace.db.common.query
- id: trace.db.common.minimal
extends: attributes.db.client.minimal
type: attribute_group
brief: This group defines the attributes used to perform database client calls.
attributes:
- ref: db.operation.name
sampling_relevant: true
- ref: server.address
sampling_relevant: true
- ref: server.port
sampling_relevant: true

- id: trace.db.common.query
extends: trace.db.common.minimal
type: attribute_group
brief: This group defines the attributes used to perform database client calls.
attributes:
- ref: db.query.text
sampling_relevant: true
requirement_level:
recommended: >
Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes
Expand All @@ -21,17 +34,19 @@ groups:
requirement_level: opt_in

- id: trace.db.common.query_and_collection
extends: attributes.db.client.minimal
extends: trace.db.common.minimal
type: attribute_group
brief: This group defines the attributes used to perform database client calls.
attributes:
- ref: db.query.text
sampling_relevant: true
requirement_level:
recommended: >
SHOULD be collected by default only if there is sanitization that excludes sensitive information.
- ref: db.query.parameter
requirement_level: opt_in
- ref: db.collection.name
sampling_relevant: true
requirement_level:
conditionally_required: >
If readily available. The collection name MAY be parsed from the query text,
Expand All @@ -55,9 +70,11 @@ groups:
requirement_level:
recommended: if and only if `network.peer.address` is set.
- ref: db.system
sampling_relevant: true
# TODO: Not adding to the minimal because of https://github.com/open-telemetry/build-tools/issues/192
requirement_level: required
- ref: db.namespace
sampling_relevant: true
requirement_level:
conditionally_required: If available.

Expand All @@ -75,6 +92,7 @@ groups:
Attributes for Microsoft SQL Server
attributes:
- ref: db.namespace
sampling_relevant: true
brief: The name of the database, fully qualified within the server address and port.
note:
When connecting to a default instance, `db.namespace` SHOULD be set to the name of
Expand All @@ -91,6 +109,7 @@ groups:
Attributes for Cassandra
attributes:
- ref: db.namespace
sampling_relevant: true
brief: The Cassandra keyspace name.
note: For commands that switch the keyspace, this SHOULD be set to the target keyspace (even if the command fails).
examples: ["mykeyspace"]
Expand All @@ -115,11 +134,12 @@ groups:
recommended: if and only if `network.peer.address` is set.
- id: db.hbase
type: span
extends: attributes.db.client.minimal
extends: trace.db.common.minimal
brief: >
Attributes for HBase
attributes:
- ref: db.namespace
sampling_relevant: true
brief: The HBase namespace.
requirement_level:
conditionally_required: If applicable.
Expand All @@ -129,6 +149,7 @@ groups:
instrumentation SHOULD set `db.namespace` value to `default`.
examples: ['mynamespace']
- ref: db.collection.name
sampling_relevant: true
brief: The HBase table name.
requirement_level:
conditionally_required: If applicable.
Expand All @@ -138,11 +159,12 @@ groups:

- id: db.couchdb
type: span
extends: attributes.db.client.minimal
extends: trace.db.common.minimal
brief: >
Attributes for CouchDB
attributes:
- ref: db.operation.name
sampling_relevant: true
brief: >
The HTTP method + the target REST route.
examples: ['GET /{db}/{docid}']
Expand All @@ -153,6 +175,7 @@ groups:
(literally, i.e., without replacing the placeholders with concrete values):
[`GET /{db}/{docid}`](https://docs.couchdb.org/en/stable/api/document/common.html#get--db-docid).
- ref: db.namespace
sampling_relevant: true
requirement_level:
conditionally_required: If available.
note: "" # overriding the base note
Expand All @@ -164,6 +187,7 @@ groups:
Attributes for Redis
attributes:
- ref: db.namespace
sampling_relevant: true
brief: >
The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select).
requirement_level:
Expand All @@ -178,6 +202,7 @@ groups:
For commands that switch the database, this SHOULD be set to the target database (even if the command fails).
examples: ["0", "1", "15"]
- ref: db.query.text
sampling_relevant: true
brief: >
The full syntax of the Redis CLI command.
examples: ["HMSET myhash field1 'Hello' field2 'World'"]
Expand All @@ -196,33 +221,37 @@ groups:

- id: db.mongodb
type: span
extends: attributes.db.client.minimal
extends: trace.db.common.minimal
brief: >
Attributes for MongoDB
attributes:
- ref: db.operation.name
sampling_relevant: true
brief: >
The name of the command being executed.
note: >
See [MongoDB database commands](https://www.mongodb.com/docs/manual/reference/command/).
examples: ['findAndModify', 'getMore', 'update']
- ref: db.collection.name
sampling_relevant: true
brief:
The MongoDB collection being accessed within the database stated in `db.namespace`.
requirement_level: required
- ref: db.namespace
sampling_relevant: true
brief: The MongoDB database name.
requirement_level:
conditionally_required: If available.
note: "" # overriding the base note

- id: db.elasticsearch
type: span
extends: attributes.db.client.minimal
extends: trace.db.common.minimal
brief: >
Attributes for Elasticsearch
attributes:
- ref: http.request.method
sampling_relevant: true
requirement_level: required
- ref: db.operation.name
requirement_level: required
Expand All @@ -231,25 +260,27 @@ groups:
(see the [Elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json)).
examples: [ 'search', 'ml.close_job', 'cat.aliases' ]
- ref: url.full
sampling_relevant: true
requirement_level: required
examples: [ 'https://localhost:9200/index/_search?q=user.id:kimchy' ]
- ref: db.query.text
sampling_relevant: true
requirement_level:
recommended: >
Should be collected by default for search-type queries and only if there is sanitization that excludes
sensitive information.
brief: The request body for a [search-type query](https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html), as a json string.
examples: [ '"{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}"' ]
- ref: db.collection.name
sampling_relevant: true
requirement_level: recommended
brief: The index or data stream against which the query is executed.
note: >
The query may target multiple indices or data streams, in which case it SHOULD be a comma separated list of those.
If the query doesn't target a specific index, this field MUST NOT be set.
examples: [ 'my_index', 'index1, index2' ]
- ref: server.address
- ref: server.port
- ref: db.namespace
sampling_relevant: true
note: >
When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Cluster" HTTP response header.
brief: The name of the Elasticsearch cluster which the client connects to.
Expand Down Expand Up @@ -344,6 +375,7 @@ groups:
requirement_level:
conditionally_required: when available
- ref: db.namespace
sampling_relevant: true
requirement_level:
conditionally_required: If available.
note: "" # overriding the base note

0 comments on commit 6e160b3

Please sign in to comment.