Skip to content

Commit 8ac8d45

Browse files
estolfotrask
andauthored
Use db.instance.id instead of specific elasticsearch node name attribute (open-telemetry#738)
Co-authored-by: Trask Stalnaker <[email protected]>
1 parent 83119ef commit 8ac8d45

File tree

6 files changed

+46
-15
lines changed

6 files changed

+46
-15
lines changed

.chloggen/738.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: enhancement
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: db
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Update Elasticsearch attributes to use db.instance.id instead of db.elasticsearch.node.name
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [725]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/attributes-registry/db.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Redis Attributes](#redis-attributes)
1515
- [SQL Attributes](#sql-attributes)
1616
- [Deprecated DB Attributes](#deprecated-db-attributes)
17+
- [Deprecated Elasticsearch Attributes](#deprecated-elasticsearch-attributes)
1718

1819
<!-- tocstop -->
1920

@@ -171,7 +172,6 @@
171172
| Attribute | Type | Description | Examples |
172173
|---|---|---|---|
173174
| `db.elasticsearch.cluster.name` | string | Represents the identifier of an Elasticsearch cluster. | `e9106fc68e3044f0b1475b04bf4ffd5f` |
174-
| `db.elasticsearch.node.name` | string | Represents the human-readable identifier of the node/instance to which a request was routed. | `instance-0000000001` |
175175
| `db.elasticsearch.path_parts.<key>` | string | A dynamic value in the url path. [1] | `db.elasticsearch.path_parts.index=test-index`; `db.elasticsearch.path_parts.doc_id=123` |
176176

177177
**[1]:** Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.<key>`, where `<key>` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.
@@ -219,5 +219,16 @@
219219
| Attribute | Type | Description | Examples |
220220
|---|---|---|---|
221221
| `db.connection_string` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Deprecated, use `server.address`, `server.port` attributes instead. | `Server=(localdb)\v11.0;Integrated Security=true;` |
222+
| `db.elasticsearch.node.name` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Deprecated, use `db.instance.id` instead. | `instance-0000000001` |
222223
| `db.jdbc.driver_classname` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Removed, no replacement at this time. | `org.postgresql.Driver`; `com.microsoft.sqlserver.jdbc.SQLServerDriver` |
223-
<!-- endsemconv -->
224+
<!-- endsemconv -->
225+
226+
### Deprecated Elasticsearch Attributes
227+
228+
<!-- semconv attributes.db.deprecated(omit_requirement_level) -->
229+
| Attribute | Type | Description | Examples |
230+
|---|---|---|---|
231+
| `db.connection_string` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Deprecated, use `server.address`, `server.port` attributes instead. | `Server=(localdb)\v11.0;Integrated Security=true;` |
232+
| `db.elasticsearch.node.name` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Deprecated, use `db.instance.id` instead. | `instance-0000000001` |
233+
| `db.jdbc.driver_classname` | string | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Removed, no replacement at this time. | `org.postgresql.Driver`; `com.microsoft.sqlserver.jdbc.SQLServerDriver` |
234+
<!-- endsemconv -->

docs/database/elasticsearch.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ If the endpoint id is not available, the span name SHOULD be the `http.request.m
2727
| Attribute | Type | Description | Examples | Requirement Level |
2828
|---|---|---|---|---|
2929
| [`db.elasticsearch.cluster.name`](../attributes-registry/db.md) | string | Represents the identifier of an Elasticsearch cluster. | `e9106fc68e3044f0b1475b04bf4ffd5f` | Recommended: [1] |
30-
| [`db.elasticsearch.node.name`](../attributes-registry/db.md) | string | Represents the human-readable identifier of the node/instance to which a request was routed. | `instance-0000000001` | Recommended: [2] |
31-
| [`db.elasticsearch.path_parts.<key>`](../attributes-registry/db.md) | string | A dynamic value in the url path. [3] | `db.elasticsearch.path_parts.index=test-index`; `db.elasticsearch.path_parts.doc_id=123` | Conditionally Required: when the url has dynamic values |
30+
| [`db.elasticsearch.path_parts.<key>`](../attributes-registry/db.md) | string | A dynamic value in the url path. [2] | `db.elasticsearch.path_parts.index=test-index`; `db.elasticsearch.path_parts.doc_id=123` | Conditionally Required: when the url has dynamic values |
31+
| [`db.instance.id`](../attributes-registry/db.md) | string | An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`. | `mysql-e26b99z.example.com` | Recommended: [3] |
3232
| [`db.operation`](../attributes-registry/db.md) | string | The endpoint identifier for the request. [4] | `search`; `ml.close_job`; `cat.aliases` | Required |
3333
| [`db.statement`](../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: [5] |
3434
| [`http.request.method`](../attributes-registry/http.md) | string | HTTP request method. [6] | `GET`; `POST`; `HEAD` | Required |
@@ -40,9 +40,9 @@ If the endpoint id is not available, the span name SHOULD be the `http.request.m
4040

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

43-
**[2]:** When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Instance" HTTP response header.
43+
**[2]:** Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.<key>`, where `<key>` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.
4444

45-
**[3]:** Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.<key>`, where `<key>` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names.
45+
**[3]:** When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Instance" HTTP response header.
4646

4747
**[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.
4848

@@ -105,6 +105,6 @@ Tracing instrumentations that do so, MUST also set `http.request.method_original
105105
| `url.full` | `"https://elasticsearch.mydomain.com:9200/my-index-000001/_search?from=40&size=20"` |
106106
| `db.elasticsearch.path_parts.index` | `"my-index-000001"` |
107107
| `db.elasticsearch.cluster.name` | `"e9106fc68e3044f0b1475b04bf4ffd5f"` |
108-
| `db.elasticsearch.node.name` | `"instance-0000000001"` |
108+
| `db.instance.id` | `"instance-0000000001"` |
109109

110110
[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/document-status.md

model/registry/db.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,6 @@ groups:
173173
Represents the identifier of an Elasticsearch cluster.
174174
examples: ["e9106fc68e3044f0b1475b04bf4ffd5f"]
175175
tag: tech-specific-elasticsearch
176-
- id: elasticsearch.node.name
177-
type: string
178-
stability: experimental
179-
brief: >
180-
Represents the human-readable identifier of the node/instance to which a request was routed.
181-
examples: ["instance-0000000001"]
182-
tag: tech-specific-elasticsearch
183176
- id: elasticsearch.path_parts
184177
type: template[string]
185178
stability: experimental

model/registry/deprecated/db.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ groups:
1616
brief: 'Removed, no replacement at this time.'
1717
deprecated: 'Removed as not used.'
1818
examples: ['org.postgresql.Driver', 'com.microsoft.sqlserver.jdbc.SQLServerDriver']
19+
- id: elasticsearch.node.name
20+
type: string
21+
brief: 'Deprecated, use `db.instance.id` instead.'
22+
deprecated: "Replaced by `db.instance.id`."
23+
examples: ["instance-0000000001"]

model/trace/database.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ groups:
189189
recommended: >
190190
When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Cluster" HTTP response header.
191191
tag: tech-specific
192-
- ref: db.elasticsearch.node.name
192+
- ref: db.instance.id
193193
requirement_level:
194194
recommended: >
195195
When communicating with an Elastic Cloud deployment, this should be collected from the "X-Found-Handling-Instance" HTTP response header.

0 commit comments

Comments
 (0)