Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change db.statement to only be collected if there is sanitization #3127

Merged
merged 28 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b1dccfc
Add a recommendation to sanitize DB_STATEMENT in order to prever secu…
avzis Jan 22, 2023
3cb5faf
Merge branch 'main' into sanitize_query_by_default
avzis Jan 22, 2023
349afc9
add changelog
avzis Jan 22, 2023
c12f2cc
Merge branch 'sanitize_query_by_default' of github.com:avzis/opentele…
avzis Jan 22, 2023
3b44c84
update database.yaml
avzis Jan 22, 2023
557775b
refactor
avzis Jan 26, 2023
83e9292
Merge branch 'main' into sanitize_query_by_default
avzis Jan 26, 2023
df3e381
lint
avzis Jan 26, 2023
cafd4df
Merge branch 'main' into sanitize_query_by_default
avzis Jan 29, 2023
ef0b1b3
Merge branch 'main' of github.com:open-telemetry/opentelemetry-specif…
avzis Feb 8, 2023
fd6615e
lint
avzis Feb 8, 2023
e334b65
refactor
avzis Feb 8, 2023
cb3e6b1
refactor
avzis Feb 8, 2023
e3cd4bd
Merge branch 'main' of github.com:open-telemetry/opentelemetry-specif…
avzis Mar 29, 2023
fde3d08
refactor
avzis Mar 29, 2023
4fa471d
changelog
avzis Mar 29, 2023
2ee38bc
refactor
avzis Mar 29, 2023
9690510
Merge branch 'main' into sanitize_query_by_default
avzis Mar 30, 2023
d9805c4
refactor
avzis Apr 2, 2023
edda622
Merge branch 'sanitize_query_by_default' of github.com:avzis/opentele…
avzis Apr 2, 2023
fcb964a
update table
avzis Apr 2, 2023
10e53c4
Merge branch 'main' into sanitize_query_by_default
avzis Apr 2, 2023
ada2f10
change to recommended
avzis Apr 4, 2023
07b86f6
Merge branch 'main' into sanitize_query_by_default
avzis Apr 4, 2023
3a0b2a6
Merge branch 'main' into sanitize_query_by_default
arminru Apr 5, 2023
c21ccd1
Merge branch 'main' into sanitize_query_by_default
arminru Apr 5, 2023
fabc0ac
Merge branch 'main' into sanitize_query_by_default
arminru Apr 6, 2023
386e633
Merge branch 'main' into sanitize_query_by_default
reyang Apr 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ release.
[#3158](https://github.com/open-telemetry/opentelemetry-specification/pull/3158)
- `http.route` SHOULD contain the "application root" if there is one.
([#3164](https://github.com/open-telemetry/opentelemetry-specification/pull/3164))
- Change `db.statement` to only be collected if there is sanitization.
([#3127](https://github.com/open-telemetry/opentelemetry-specification/pull/3127))

### Compatibility

Expand Down
5 changes: 2 additions & 3 deletions semantic_conventions/trace/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,10 @@ groups:
tag: call-level
type: string
requirement_level:
conditionally_required: >
If applicable and not explicitly disabled via instrumentation configuration.
recommended: >
Should be collected by default only if there is sanitization that excludes sensitive information.
brief: >
The database statement being executed.
note: The value may be sanitized to exclude sensitive information.
examples: ['SELECT * FROM wuser_table', 'SET mykey "WuValue"']
- id: operation
tag: call-level
Expand Down
10 changes: 4 additions & 6 deletions specification/trace/semantic_conventions/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,14 @@ Usually only one `db.name` will be used per connection though.
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `db.name` | string | This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). [1] | `customers`; `main` | Conditionally Required: If applicable. |
| `db.statement` | string | The database statement being executed. [2] | `SELECT * FROM wuser_table`; `SET mykey "WuValue"` | Conditionally Required: [3] |
| `db.operation` | string | The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. [4] | `findAndModify`; `HMSET`; `SELECT` | Conditionally Required: If `db.statement` is not applicable. |
| `db.statement` | string | The database statement being executed. | `SELECT * FROM wuser_table`; `SET mykey "WuValue"` | Recommended: [2] |
| `db.operation` | string | The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. [3] | `findAndModify`; `HMSET`; `SELECT` | Conditionally Required: If `db.statement` is not applicable. |

**[1]:** In some SQL databases, the database name to be used is called "schema name". In case there are multiple layers that could be considered for database name (e.g. Oracle instance name and schema name), the database name to be used is the more specific layer (e.g. Oracle schema name).

**[2]:** The value may be sanitized to exclude sensitive information.
**[2]:** Should be collected by default only if there is sanitization that excludes sensitive information.

**[3]:** If applicable and not explicitly disabled via instrumentation configuration.

**[4]:** When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.
**[3]:** When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted.
<!-- endsemconv -->

For **Redis**, the value provided for `db.statement` SHOULD correspond to the syntax of the Redis CLI.
Expand Down