-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[APM] Avoid using _source for OTel compatibility #189947
Comments
Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services) |
From what I could see we can change to @gregkalapos There are other places on APM where we use the |
Nice 🎉 Great to hear that.
Yes, this issue is about considering completely moving away from |
From an efficiency perspective particularly in combination with synthetic _source, using |
Same for {
"track_total_hits": false,
"size": 0,
"query": {
"bool": {
"filter": [
{
"terms": {
"processor.event": [
"error"
]
}
}
],
"must": [
{
"bool": {
"filter": [
{
"term": {
"service.name": "sendotlp"
}
},
{
"range": {
"@timestamp": {
"gte": 1724164013052,
"lte": 1724164913052,
"format": "epoch_millis"
}
}
}
]
}
}
]
}
},
"aggs": {
"error_groups": {
"terms": {
"field": "error.grouping_key",
"size": 500,
"order": {
"_count": "desc"
}
},
"aggs": {
"sample": {
"top_hits": {
"size": 1,
"_source": [
"trace.id",
"error.log.message",
"error.exception.message",
"error.exception.handled",
"error.exception.type",
"error.culprit",
"error.grouping_key",
"@timestamp"
],
"sort": {
"@timestamp": "desc"
}
}
}
}
}
}
} I'm going to start a tasklist in this issue to capture _source usages we've encountered |
One usage of _source that we probably can't remove but need to adjust for OTel are span links. They're stored differently but only the _source will have the right ordering of the object array. There are also other aspects of span links (in particular incoming links from other traces) that need adjustment for OTel. |
I've run into a couple of queries that are a bit tricky and I'm not sure the best way to go about resolving them. kibana/x-pack/plugins/observability_solution/apm/server/routes/traces/get_trace_items.ts Line 209 in 0c911c8
This returns an entire transaction with a nested format e.g.:
where fields will return :
should the new field responses be marshaled into the nested format, or should downstream dependencies be rebuilt to use the new format? |
I've got an initial PR covering a few APIs so far: #191647 |
closing in favour of #192606 |
As we work towards OTel native support, we expect data to be stored in more OTel native format in Elasticsearch. E.g. see: elastic/elasticsearch#111091
The result of this is that the shape of the data will be different compared to what we currently have in the APM data streams.
At the same time, we also add a compatibility layer to make sure the current UI works with the new data. This layer is mainly based on aliases and passthrough fields.
The problem where this currently breaks is that the UI in some cases uses
_source
to accesses data. That is currently a blocker for the compatibly layer as some of these fields are not directly available under_source
.Specific example:
On the service summary page in this part the UI accesses fields from
_source
to populate the icons:kibana/x-pack/plugins/observability_solution/apm/server/routes/services/get_service_metadata_icons.ts
Line 75 in 7167096
In this example we have a field that stores agent name.
Here is how an OTel native data in Elasticsearch will look like:
See field
resource.attributes.agent.name
- that is how we store attributes in OTel native data. Everything underresource.attributes
can be queried as a top level field, but those fields under_source
are of course still underresource.attributes.*
. So in practice there is an alias fromagent.name
toresource.attributes.agent.name
.Currently the query above does something like this:
Where
agent.name
will not be returned, because it's used from_source
.Question is: is using
_source
needed? If e.g. this would be rewritten to use the fields API, then this will work:Of course there may be other ways to do it and there may be some downside of using
fields
- which I don't know of.So the 1. proposal is to check if using the fields API is acceptable and if the answer is yes, then the APM UI should move to using that instead of
_source
. If that's not possible, we should discuss other options.Non exhaustive list of _source usages
Sub tasks
The text was updated successfully, but these errors were encountered: