-
Notifications
You must be signed in to change notification settings - Fork 888
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
Add semantic conventions for Elasticsearch client instrumentation #3358
Changes from all commits
6677724
9916917
16470fc
f3ecf2c
db620a8
0195b6f
86f988f
38f8fc2
4a15793
c3c1285
164fe73
5d3fc99
9df0d56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||
# Semantic conventions for Elasticsearch | ||||||
|
||||||
**Status**: [Experimental](../../../document-status.md) | ||||||
|
||||||
This document defines semantic conventions to apply when instrumenting requests to Elasticsearch. They map Elasticsearch | ||||||
requests to attributes on a Span. | ||||||
|
||||||
## Span Name | ||||||
|
||||||
The **span name** SHOULD be of the format `<http.method> <db.elasticsearch.url *with placeholders*>`. | ||||||
|
||||||
The elasticsearch url is modified with placeholders in order to reduce the cardinality of the span name. When the url | ||||||
contains a document id, it SHOULD be replaced by the identifier `{id}`. When the url contains a target data stream or | ||||||
index, it SHOULD be replaced by `{target}`. | ||||||
For example, a request to `/test-index/_doc/123` should have the span name `GET /{target}/_doc/{id}`. | ||||||
When there is no target or document id, the span name will contain the exact url, as in `POST /_search`. | ||||||
|
||||||
### Span attributes | ||||||
estolfo marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
<!-- semconv elasticsearch --> | ||||||
| Attribute | Type | Description | Examples | Requirement Level | | ||||||
|----------------------------|---|----------------------------------------------------------------------|---------------------------------------------------------|------------------------| | ||||||
| `db.elasticsearch.doc_id` | string | The document that the request targets, specified in the path. | `'123'` | Conditionally Required | | ||||||
| `db.elasticsearch.target` | string | The name of the data stream or index that is targeted. | `'users'` | Conditionally Required | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this also extracted from the path?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That depends on the implementation of the client. It's possible that the client is written in way such that the target is specified as an argument or part of a hash passed to the function/method. The Ruby client, for example, has the target specified in the hash passed as an arg to the action method. |
||||||
| `db.elasticsearch.url.path` | string | The exact path of the request, including the target and document id. | `'/test-index/_doc/123'` | Required | | ||||||
| `db.elasticsearch.url.query` | string | The query params of the request, as a json string. | `'"{\"q\":\"test\"}", "{\"refresh\":true}"'` | Conditionally Required | | ||||||
| `db.statement` | string | The request body, as a json string. [1] | `"{\"name\":\"TestUser\",\"password\":\"top_secret\"}"` | Conditionally Required | | ||||||
| `http.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Required | | ||||||
|
||||||
**[1]:** The value may be sanitized to exclude sensitive information. | ||||||
<!-- endsemconv --> |
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.