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

Adapt Elasticsearch spec to stability changes #1002

Merged
merged 22 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
24 changes: 24 additions & 0 deletions .chloggen/align_es_spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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: breaking

# 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: >
Align Elasticsearch span name to the general database span name guidelines.
Deprecates `db.elasticsearch.cluster.name` in favor of `db.namespace`.

# 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: [1002]

# (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:
22 changes: 22 additions & 0 deletions .chloggen/influxdb.yaml
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: Add semantic convention of InfluxDB
lmolkova marked this conversation as resolved.
Show resolved Hide resolved

# 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: [949]

# (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:
310 changes: 168 additions & 142 deletions docs/attributes-registry/db.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/database/database-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ If a database operation involved multiple network calls (for example retries), t
| `hbase` | Apache HBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hive` | Apache Hive | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hsqldb` | HyperSQL DataBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `influxdb` | InfluxDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `informix` | Informix | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `ingres` | Ingres | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `instantdb` | InstantDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand Down
1 change: 1 addition & 0 deletions docs/database/database-spans.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ If a parameter has no name and instead is referenced only by index, then `<key>`
| `hbase` | Apache HBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hive` | Apache Hive | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hsqldb` | HyperSQL DataBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `influxdb` | InfluxDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `informix` | Informix | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `ingres` | Ingres | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `instantdb` | InstantDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand Down
1 change: 1 addition & 0 deletions docs/database/dynamodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ These attributes are filled in for all DynamoDB request types.
| `hbase` | Apache HBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hive` | Apache Hive | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `hsqldb` | HyperSQL DataBase | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `influxdb` | InfluxDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `informix` | Informix | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `ingres` | Ingres | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `instantdb` | InstantDB | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Expand Down
32 changes: 18 additions & 14 deletions docs/database/elasticsearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ described on this page.

## Span Name

The **span name** SHOULD be of the format `<endpoint id>`.

The elasticsearch endpoint identifier is used instead of the url path in order to reduce the cardinality of the span
name, as the path could contain dynamic values. The endpoint id is the `name` field in the
The **span name** follows the [general database span name guidelines](database-spans.md#name) with the endpoint identifier stored in `db.operation.name`, instead of the url path in order to reduce the cardinality of the span and the index stored in `db.collection.name`. The endpoint id is the `name` field in the
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
[elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json).
If the endpoint id is not available, the span name SHOULD be the `http.request.method`.

## Attributes

Expand All @@ -38,10 +34,11 @@ If the endpoint id is not available, the span name SHOULD be the `http.request.m
| [`db.elasticsearch.path_parts.<key>`](/docs/attributes-registry/db.md) | string | A dynamic value in the url path. [4] | `db.elasticsearch.path_parts.index=test-index`; `db.elasticsearch.path_parts.doc_id=123` | `Conditionally Required` when the url has dynamic values | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`error.type`](/docs/attributes-registry/error.md) | string | Describes a class of error the operation ended with. [5] | `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) |
| [`server.port`](/docs/attributes-registry/server.md) | int | Server port number. [6] | `80`; `8080`; `443` | `Conditionally Required` [7] | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.elasticsearch.cluster.name`](/docs/attributes-registry/db.md) | string | Represents the identifier of an Elasticsearch cluster. | `e9106fc68e3044f0b1475b04bf4ffd5f` | `Recommended` [8] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
trask marked this conversation as resolved.
Show resolved Hide resolved
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The index or data stream against which the query is executed. [8] | `my_index`; `index1, index2` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.elasticsearch.node.name`](/docs/attributes-registry/db.md) | string | Represents the human-readable identifier of the node/instance to which a request was routed. | `instance-0000000001` | `Recommended` [9] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The request body for a [search-type query](https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html), as a json string. | `"{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}"` | `Recommended` [10] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [11] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.namespace`](/docs/attributes-registry/db.md) | string | The name of the database, fully qualified within the server address and port. [10] | `customers`; `test.users` | `Recommended` [11] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`db.query.text`](/docs/attributes-registry/db.md) | string | The request body for a [search-type query](https://www.elastic.co/guide/en/elasticsearch/reference/current/search.html), as a json string. | `"{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}"` | `Recommended` [12] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`server.address`](/docs/attributes-registry/server.md) | string | Name of the database host. [13] | `example.com`; `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

**[1]:** This SHOULD be the endpoint identifier for the request.

Expand Down Expand Up @@ -72,13 +69,19 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original

**[7]:** If using a port other than the default port for this DBMS and if `server.address` is set.

**[8]:** When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Cluster" HTTP response header.
**[8]:** If the query targets multiple indices or data streams, then the name of those should be added as a comma separated list. If the query doesn't target a specific index, this field MUST NOT be set.

**[9]:** When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Instance" HTTP response header.

**[10]:** Should be collected by default for search-type queries and only if there is sanitization that excludes sensitive information.
**[10]:** If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid.
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system.
It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization.

**[11]:** The name of the Elasticsearch cluster which the client connects to. When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Cluster" HTTP response header.

**[12]:** Should be collected by default for search-type queries and only if there is sanitization that excludes sensitive information.

**[11]:** 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.
**[13]:** 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.



Expand Down Expand Up @@ -115,16 +118,17 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original

| Key | Value |
|:------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------|
| Span name | `"search"` |
| Span name | `"search my-index"` |
| `db.system` | `"elasticsearch"` |
| `server.address` | `"elasticsearch.mydomain.com"` |
| `server.port` | `9200` |
| `http.request.method` | `"GET"` |
| `db.query.text` | `"{\"query\":{\"term\":{\"user.id\":\"kimchy\"}}}"` |
| `db.operation.name` | `"search"` |
| `db.collection.name` | `"my-index"` |
| `url.full` | `"https://elasticsearch.mydomain.com:9200/my-index-000001/_search?from=40&size=20"` |
| `db.elasticsearch.path_parts.index` | `"my-index-000001"` |
| `db.elasticsearch.cluster.name` | `"e9106fc68e3044f0b1475b04bf4ffd5f"` |
| `db.instance.id` | `"instance-0000000001"` |
| `db.namespace` | `"e9106fc68e3044f0b1475b04bf4ffd5f"` |
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
| `db.elasticsearch.node.name` | `"instance-0000000001"` |

[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/document-status.md
10 changes: 4 additions & 6 deletions model/registry/db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ groups:
value: 'hsqldb'
brief: 'HyperSQL DataBase'
stability: experimental
- id: influxdb
value: 'influxdb'
brief: 'InfluxDB'
stability: experimental
- id: informix
value: 'informix'
brief: 'Informix'
Expand Down Expand Up @@ -474,12 +478,6 @@ groups:
brief: >
This group defines attributes for Elasticsearch.
attributes:
- id: elasticsearch.cluster.name
type: string
stability: experimental
brief: >
Represents the identifier of an Elasticsearch cluster.
examples: ["e9106fc68e3044f0b1475b04bf4ffd5f"]
- id: elasticsearch.node.name
type: string
stability: experimental
Expand Down
7 changes: 7 additions & 0 deletions model/registry/deprecated/db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ groups:
brief: 'Deprecated, no general replacement at this time. For Elasticsearch, use `db.elasticsearch.node.name` instead.'
deprecated: 'Deprecated, no general replacement at this time. For Elasticsearch, use `db.elasticsearch.node.name` instead.'
examples: 'mysql-e26b99z.example.com'
- id: elasticsearch.cluster.name
type: string
stability: experimental
deprecated: Use `db.namespace` instead.
brief: >
Represents the identifier of an Elasticsearch cluster.
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
examples: ["e9106fc68e3044f0b1475b04bf4ffd5f"]

- id: registry.db.metrics.deprecated
type: attribute_group
Expand Down
12 changes: 11 additions & 1 deletion model/trace/database.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,21 @@ groups:
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\"}}}"' ]
tag: tech-specific
gregkalapos marked this conversation as resolved.
Show resolved Hide resolved
- ref: db.collection.name
requirement_level: recommended
brief: The index or data stream against which the query is executed.
note: >
If the query targets multiple indices or data streams, then the name of those should be added as a comma separated list.
gregkalapos marked this conversation as resolved.
Show resolved Hide resolved
If the query doesn't target a specific index, this field MUST NOT be set.
examples: [ 'my_index', 'index1, index2' ]
tag: tech-specific
gregkalapos marked this conversation as resolved.
Show resolved Hide resolved
- ref: server.address
- ref: server.port
- ref: db.elasticsearch.cluster.name
- ref: db.namespace
requirement_level:
recommended: >
The name of the Elasticsearch cluster which the client connects to.
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Cluster" HTTP response header.
lmolkova marked this conversation as resolved.
Show resolved Hide resolved
- ref: db.elasticsearch.node.name
requirement_level:
Expand Down