Skip to content

Commit 3e2d451

Browse files
author
Liudmila Molkova
committed
provide system-specific db status code notes
1 parent ffbed65 commit 3e2d451

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

docs/database/mariadb.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ Instrumentation SHOULD document if `db.namespace` reflects the database provided
4242

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

45-
**[2] `db.response.status_code`:** When [SQLSTATE](https://mariadb.com/kb/en/sqlstate/) is available, SQLSTATE of "Class 02" or higher SHOULD be considered errors.). When SQLSTATE is not available, all Maria DB error codes SHOULD be considered errors.
45+
**[2] `db.response.status_code`:** MariaDB uses vendor-specific error codes on all errors and reports [SQLSTATE](https://mariadb.com/kb/en/sqlstate/) in some cases.
46+
MariaDB error codes are more granular than SQLSTATE, so MariaDB instrumentations SHOULD set the `db.response.status_code` to this known error code.
47+
When SQLSTATE is available, SQLSTATE of "Class 02" or higher SHOULD be considered errors. When SQLSTATE is not available, all MariaDB error codes SHOULD be considered errors.
4648

4749
**[3] `error.type`:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
4850
When using canonical exception type name, instrumentation SHOULD do the best effort to report the most relevant type. For example, if the original exception is wrapped into a generic one, the original exception SHOULD be preferred.

docs/database/mysql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The Semantic Conventions for *MySQL* extend and override the [Database Semantic
2222
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
2323
|---|---|---|---|---|---|
2424
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The database associated with the connection. [1] | `products`; `customers` | `Conditionally Required` If available without an additional network call. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
25-
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | [MySQL error number](https://dev.mysql.com/doc/mysql-errors/9.0/en/error-reference-introduction.html). [2] | `1005`; `MY-010016` | `Conditionally Required` If response has ended with warning or an error. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
25+
| [`db.response.status_code`](/docs/attributes-registry/db.md) | string | [MySQL error number](https://dev.mysql.com/doc/mysql-errors/9.0/en/error-reference-introduction.html) recorded as a string. [2] | `1005`; `MY-010016` | `Conditionally Required` If response has ended with warning or an error. | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
2626
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [3] | `timeout`; `java.net.UnknownHostException`; `server_certificate_invalid`; `500` | `Conditionally Required` If and only if the operation failed. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
2727
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [4] | `80`; `8080`; `443` | `Conditionally Required` [5] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
2828
| [`db.operation.batch.size`](/docs/attributes-registry/db.md) | int | The number of queries included in a batch operation. [6] | `2`; `3`; `4` | `Recommended` | ![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid) |
@@ -42,7 +42,7 @@ Instrumentation SHOULD document if `db.namespace` reflects the database provided
4242

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

45-
**[2] `db.response.status_code`:** All MySQL error codes SHOULD be considered errors.
45+
**[2] `db.response.status_code`:** MySQL error codes are vendor specific error codes and don't follow [SQLSTATE](https://wikipedia.org/wiki/SQLSTATE) conventions. All MySQL error codes SHOULD be considered errors.
4646

4747
**[3] `error.type`:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
4848
When using canonical exception type name, instrumentation SHOULD do the best effort to report the most relevant type. For example, if the original exception is wrapped into a generic one, the original exception SHOULD be preferred.

docs/database/postgresql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Instrumentation SHOULD document if `db.namespace` reflects the user provided whe
4949

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

52-
**[2] `db.response.status_code`:** Response codes of "Class 02" or higher SHOULD be considered errors.
52+
**[2] `db.response.status_code`:** PostgreSQL follows SQL standard conventions for [SQLSTATE](https://wikipedia.org/wiki/SQLSTATE). Response codes of "Class 02" or higher SHOULD be considered errors.
5353

5454
**[3] `error.type`:** The `error.type` SHOULD match the `db.response.status_code` returned by the database or the client library, or the canonical name of exception that occurred.
5555
When using canonical exception type name, instrumentation SHOULD do the best effort to report the most relevant type. For example, if the original exception is wrapped into a generic one, the original exception SHOULD be preferred.

docs/exceptions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ path_base_for_github_subdir:
77

88
# Semantic Conventions for Exceptions
99

10-
**Status**: [Mixed][DocumentStatus]
10+
**Status**: [Stable][DocumentStatus], Unless otherwise specified.
1111

1212
Semantic conventions for Exceptions are defined for the following signals:
1313

docs/http/http-spans.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ When instrumentation detects such errors it SHOULD set span status to `Error`
118118
and SHOULD set the `error.type` attribute.
119119

120120
Refer to the [Recording Errors](/docs/general/recording-errors.md) document for
121-
details on how to record span status.
121+
general considerations on how to record span status.
122122

123123
## HTTP client
124124

model/database/spans.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ groups:
187187
brief: >
188188
[PostgreSQL error code](https://www.postgresql.org/docs/current/errcodes-appendix.html).
189189
note: >
190+
PostgreSQL follows SQL standard conventions for [SQLSTATE](https://wikipedia.org/wiki/SQLSTATE).
190191
Response codes of "Class 02" or higher SHOULD be considered errors.
191192
examples: ["08000", "08P01"]
192-
193193
- id: span.db.mysql.client
194194
type: span
195195
stability: experimental
@@ -214,9 +214,10 @@ groups:
214214
examples: ["products", "customers"]
215215
- ref: db.response.status_code
216216
brief: >
217-
[MySQL error number](https://dev.mysql.com/doc/mysql-errors/9.0/en/error-reference-introduction.html).
217+
[MySQL error number](https://dev.mysql.com/doc/mysql-errors/9.0/en/error-reference-introduction.html) recorded as a string.
218218
note: >
219-
All MySQL error codes SHOULD be considered errors.
219+
MySQL error codes are vendor specific error codes and don't follow [SQLSTATE](https://wikipedia.org/wiki/SQLSTATE)
220+
conventions. All MySQL error codes SHOULD be considered errors.
220221
examples: ["1005", "MY-010016"]
221222

222223
- id: span.db.mariadb.client
@@ -246,12 +247,17 @@ groups:
246247
[Maria DB error code](https://mariadb.com/kb/en/mariadb-error-code-reference/)
247248
represented as a string.
248249
note: >
249-
When [SQLSTATE](https://mariadb.com/kb/en/sqlstate/) is available, SQLSTATE of
250-
"Class 02" or higher SHOULD be considered errors.). When SQLSTATE is not available,
251-
all Maria DB error codes SHOULD be considered errors.
250+
MariaDB uses vendor-specific error codes on all errors and reports
251+
[SQLSTATE](https://mariadb.com/kb/en/sqlstate/) in some cases.
252252
253-
examples: ["1008", "3058"]
253+
MariaDB error codes are more granular than SQLSTATE, so MariaDB instrumentations
254+
SHOULD set the `db.response.status_code` to this known error code.
254255
256+
When SQLSTATE is available, SQLSTATE of "Class 02" or higher SHOULD be
257+
considered errors. When SQLSTATE is not available, all MariaDB error
258+
codes SHOULD be considered errors.
259+
260+
examples: ["1008", "3058"]
255261
- id: span.db.cassandra.client
256262
type: span
257263
span_kind: client

0 commit comments

Comments
 (0)