-
Notifications
You must be signed in to change notification settings - Fork 227
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
Reconsider structure of context.db.statement
#2019
Comments
Some background for others. Dale and I discussed this a little bit before this ticket. Currently the structure of apm-agent-nodejs/lib/instrumentation/elasticsearch-shared.js Lines 18 to 56 in c64a089
That structure is mention in the changelog (Dale linked to it above), but not elsewhere in docs. Here is the section of the current apm-server spec that governs what fields are allowed in That Elasticsearch allows material fields for the query to be in either the query params and/or the body is what led to changing the form in v3.10.0 of the agent. Earlier versions of the Node.js APM agent would only include the query params if the body was empty. The content/structure of
I think it is more than it being about multiple agent languages (which is one issue), but also that current structureAnother question is whether the current structure provides the data you need. For example, I have a play app that makes a search using the ES client like so: client.search({
index: 'kibana_sample_data_logs',
body: {
size: 1,
query: {
match_all: {}
}
}
}
... from which the ES client provides this data on the request:
and for which the current Node.js APM agent includes this data:
Note that the compatibility guaranteesAs a fallback, theoretically your es-rally processor of this data should have the agent version available as a mechanism for dealing with structure changes:
However, obviously that isn't great for your code maint. I think, at the least, we document in the Node.js APM agent code that the current structure is being relied upon by your es rally code, so the APM developer is aware if considering making changes. I don't have a solid feel yet for if we want to lock it down as a major breaking change. I suspect in this case it wouldn't cause undue burden for APM agent maint to make this structure a promised interface -- perhaps after discussion here on whether we want to change the structure a last time first. |
I'd propose to set Would that work for you, @gingerwizard? |
That makes a lot of sense to me if its compatible with the current usage of those fields. |
Sounds good to me. I can take this. |
That general issue is related to this one: elastic/apm#439 |
We utilise the Node JS agent to capture Elasticsearch queries from Kibana. For this we need the full content body which is currently captured in the field
context.db.statement
. This value, however, contains the request body and URL (with parameters) delimited by two new lines. In order for us to extract the ES body + index name + any parameters, we currently parse this payload client side.This obviously works it makes our code susceptible to changes in the agent. Whilst fields are governed by ECS and a change control process, are changes in the structure of field values also considered potentially breaking changes? If so, could such changes be made in a minor or could we rely on their consistency across majors?
https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-3.x.html#release-notes-3.10.0 suggests that changes can be made in a minor which is concerning.
This is further complicated by the fact we use the agent version distributed with Kibana, so we would need to track the agent version this uses.
One proposal is that these values be stored in separate fields i.e. only the request body be stored in
context.db.statement
and the params and index names be stored in separate fields. The agent would in effect be responsible for parsing these values. Whilst we would prefer this solution, we appreciate that is a decision beyond a single agent.@trentm
The text was updated successfully, but these errors were encountered: