-
Notifications
You must be signed in to change notification settings - Fork 253
Add in Surreal DB client spans #1107 #2571
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
Open
thompson-tomo
wants to merge
3
commits into
open-telemetry:main
Choose a base branch
from
thompson-tomo:feature/#1107_AddSurrealDB
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
# | ||
# If your change doesn't affect end users you should instead start | ||
# your pull request title with [chore] or use the "Skip Changelog" label. | ||
|
||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) | ||
component: db | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: This adds SurrealDB as a db system. | ||
|
||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
# The values here must be integers. | ||
issues: [1107] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<!--- Hugo front matter used to generate the website version of this page: | ||
linkTitle: SurrealDB | ||
---> | ||
|
||
# Semantic conventions for SurrealDB client operations | ||
|
||
**Status**: [Development][DocumentStatus] | ||
|
||
The Semantic Conventions for SurrealDB extend and override the Database Semantic Conventions. | ||
|
||
## Spans | ||
|
||
<!-- semconv span.db.surrealdb.client --> | ||
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. --> | ||
<!-- see templates/registry/markdown/snippet.md.j2 --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-capture --> | ||
<!-- markdownlint-disable --> | ||
|
||
**Status:**  | ||
|
||
Spans representing calls to a SurrealDB database adhere to the general [Semantic Conventions for Database Client Spans](database-spans.md). | ||
|
||
`db.system.name` MUST be set to `"surrealdb"` and SHOULD be provided **at span creation time**. | ||
|
||
**Span kind** SHOULD be `CLIENT`. | ||
|
||
**Span status** SHOULD follow the [Recording Errors](/docs/general/recording-errors.md) document. | ||
|
||
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability | | ||
|---|---|---|---|---|---| | ||
| [`db.namespace`](/docs/registry/attributes/db.md) | string | The database associated with the connection, fully qualified within the server address and port. [1] | `customers`; `webshop\|customers` | `Conditionally Required` If available without an additional network call. |  | | ||
| [`db.response.status_code`](/docs/registry/attributes/db.md) | string | Database response code recorded as a string. [2] | `ORA-17027`; `1052`; `2201B` | `Conditionally Required` If response has ended with warning or an error. |  | | ||
| [`error.type`](/docs/registry/attributes/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. |  | | ||
| [`server.port`](/docs/registry/attributes/server.md) | int | Server port number. [4] | `80`; `8080`; `443` | `Conditionally Required` [5] |  | | ||
| [`db.collection.name`](/docs/registry/attributes/db.md) | string | The name of the table within the database. | `public.users`; `customers` | `Recommended` |  | | ||
| [`db.operation.batch.size`](/docs/registry/attributes/db.md) | int | The number of queries included in a batch operation. [6] | `2`; `3`; `4` | `Recommended` |  | | ||
| [`db.operation.name`](/docs/registry/attributes/db.md) | string | The name of the operation or command being executed. [7] | `EXECUTE`; `INSERT` | `Recommended` |  | | ||
| [`db.query.summary`](/docs/registry/attributes/db.md) | string | Low cardinality summary of a database query. [8] | `SELECT wuser_table`; `INSERT shipping_details SELECT orders`; `get user by id` | `Recommended` |  | | ||
| [`db.query.text`](/docs/registry/attributes/db.md) | string | The database query being executed. [9] | `SELECT * FROM wuser_table where username = ?`; `SET mykey ?` | `Recommended` [10] |  | | ||
| [`db.stored_procedure.name`](/docs/registry/attributes/db.md) | string | In SurrealDB this refers to the function being invoked. | `GetCustomer` | `Recommended` [11] |  | | ||
| [`network.protocol.name`](/docs/registry/attributes/network.md) | string | [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent. [12] | `amqp`; `http`; `mqtt` | `Recommended` |  | | ||
| [`server.address`](/docs/registry/attributes/server.md) | string | Name of the database host. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` |  | | ||
| [`db.query.parameter.<key>`](/docs/registry/attributes/db.md) | string | A database query parameter, with `<key>` being the parameter name, and the attribute value being a string representation of the parameter value. [14] | `someval`; `55` | `Opt-In` |  | | ||
| [`db.response.returned_rows`](/docs/registry/attributes/db.md) | int | Number of rows returned by the operation. | `10`; `30`; `1000` | `Opt-In` |  | | ||
|
||
**[1] `db.namespace`:** SurrealDB has the notion of both namespace & database for each client. As such the structure of this attribute would become `{{Namespace}}|{{Database}}`. | ||
|
||
**[2] `db.response.status_code`:** The http response status code is to be used as the database status code. | ||
|
||
**[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. | ||
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. | ||
Instrumentations SHOULD document how `error.type` is populated. | ||
|
||
**[4] `server.port`:** When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available. | ||
|
||
**[5] `server.port`:** If using a port other than the default port for this DBMS and if `server.address` is set. | ||
|
||
**[6] `db.operation.batch.size`:** Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`. | ||
|
||
**[7] `db.operation.name`:** The operation name is to reflect the api method being called ie upsert. | ||
|
||
**[8] `db.query.summary`:** The query summary is to be a concatenation of the method and table being acted on. | ||
|
||
**[9] `db.query.text`:** For sanitization see [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext). | ||
For batch operations, if the individual operations are known to have the same query text 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. | ||
|
||
**[10] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See [Sanitization of `db.query.text`](/docs/database/database-spans.md#sanitization-of-dbquerytext). | ||
Parameterized query text SHOULD be collected by default (the query parameter values themselves are opt-in, see [`db.query.parameter.<key>`](/docs/registry/attributes/db.md)). | ||
|
||
**[11] `db.stored_procedure.name`:** If operation applies to a specific stored procedure. | ||
|
||
**[12] `network.protocol.name`:** The value SHOULD be normalized to lowercase. | ||
|
||
**[13] `server.address`:** When observed from the client side, and when communicating through an intermediary, `server.address` SHOULD represent the server address behind any intermediaries, for example proxies, if it's available. | ||
|
||
**[14] `db.query.parameter.<key>`:** If a query parameter has no name and instead is referenced only by index, | ||
then `<key>` SHOULD be the 0-based index. | ||
|
||
`db.query.parameter.<key>` SHOULD match | ||
up with the parameterized placeholders present in `db.query.text`. | ||
|
||
`db.query.parameter.<key>` SHOULD NOT be captured on batch operations. | ||
|
||
Examples: | ||
|
||
- For a query `SELECT * FROM users where username = %s` with the parameter `"jdoe"`, | ||
the attribute `db.query.parameter.0` SHOULD be set to `"jdoe"`. | ||
|
||
- For a query `"SELECT * FROM users WHERE username = %(username)s;` with parameter | ||
`username = "jdoe"`, the attribute `db.query.parameter.username` SHOULD be set to `"jdoe"`. | ||
|
||
The following attributes can be important for making sampling decisions | ||
and SHOULD be provided **at span creation time** (if provided at all): | ||
|
||
* [`db.query.summary`](/docs/registry/attributes/db.md) | ||
* [`db.query.text`](/docs/registry/attributes/db.md) | ||
* [`server.address`](/docs/registry/attributes/server.md) | ||
* [`server.port`](/docs/registry/attributes/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 | | ||
|---|---|---| | ||
| `_OTHER` | A fallback error value to be used when the instrumentation doesn't define a custom value. |  | | ||
|
||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
<!-- END AUTOGENERATED TEXT --> | ||
<!-- endsemconv --> | ||
|
||
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I would have expect a list item or table for each operation name, so that every client uses the same name/convention. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked at other db provider docs and none of them except for cosmosdb provide table/lists of operation names.