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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gregkalapos
Copy link
Member

@gregkalapos gregkalapos commented May 3, 2024

Follow up from #974 (comment).

Changes

  • Align Elasticsearch span names with the format defined in the general db spec. MongoDB is comparable and it already follows this format. The idea is to not only have the operation (endpoint id) in the span name, but also the target.
  • Adding db.collection.name to the Elasticsearch spec, which is used in the span name as well.
  • Changed the last fallback in the span name from http.request.method to db.system. The thinking behind this is that db.system is usually the last fallback for other DBs. This was also the outcome in Better guidance on semantic conventions for database client call span names in case of missing information #704. In practice this fallback is used extremely rarely since endpoint id is usually available.

Questions

  • db.elasticsearch.cluster.name could be replaced with db.namespace. Do we want to do that?
  • I think we could consider making this stable at this point. Any thoughts on this? I'd prefer to try to make this stable.

Merge requirement checklist

@gregkalapos gregkalapos marked this pull request as ready for review May 3, 2024 14:51
@gregkalapos gregkalapos requested review from a team as code owners May 3, 2024 14:51
@gregkalapos gregkalapos changed the title Adapt Elasticsearch spec to stability changes [chore] Adapt Elasticsearch spec to stability changes May 3, 2024
@gregkalapos gregkalapos changed the title [chore] Adapt Elasticsearch spec to stability changes Adapt Elasticsearch spec to stability changes May 3, 2024
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.
If the query doesn't target a specific index, this field should remain empty.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If the query doesn't target a specific index, this field should remain empty.
If the query doesn't target a specific index, this field MUST NOT be set.

@@ -14,12 +14,13 @@ described on this page.

## Span Name

The **span name** SHOULD be of the format `<endpoint id>`.
The **span name** SHOULD be of the format `{db.operation.name} {db.collection.name}`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this section is necessary, it seems to be perfectly aligned with the general db span name guidance now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point, but a bit tricky as well. In general what I propose here is very similar to the general db span name guideline, but it differs a bit, specifically: db.collection.name isn't available for all queries - there could be queries that target all indices or no index - in that case we won't have this value and it'd be very unfortunate to fall back to the next item in the {target} list from the general spec. I think the target list is very useful when all spans have the same set of attributes, but if the list of attributes changes within the same instrumentation (and potentially within the same trace), then we need a solution for that, otherwise the span name format will be mixed.

I opened #1045 to discuss this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #1061 to address it. If that goes in, we can drop this part and Elasticsearch can follow the general DB span name guidelines.

| [`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` [9] | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`network.peer.address`](/docs/attributes-registry/network.md) | string | Peer address of the database node where the operation was performed. [10] | `10.1.2.80`; `/tmp/my.sock` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`db.collection.name`](/docs/attributes-registry/db.md) | string | The index or data stream against which the query is executed. [7] | `my_index`; `index1, index2` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`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) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be replaced by db.namespace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Status: In Discussions
Development

Successfully merging this pull request may close these issues.

None yet

4 participants