-
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
feat: 'elasticsearchCaptureBodyUrls' config option #2873
Conversation
This adds a new config option, per the 'elasticsearch_capture_body_urls' cross-agent spec, to control for which ES client requests the request body is captured. By default it is just the body of search-related APIs. The use case for configuring this is to capture for *all* requests for reply in Kibana performance work. This option is not expected to be used often.
run module tests for elasticsearch,@elastic/elasticsearch |
some premature optimization perf notesI digressed slightly to sanity check that the change in ES URL path checking here (from a custom tl;dr: The WildcardMatcher-based comparison is much slower. However, it is on the order of 1 microsecond per path check on my MacBook Pro (2.4 GHz 8-Core Intel Core i9). Given that ES queries are remote calls and on the order of milliseconds, it would generally be premature optimization to bother getting fancy to improve performance of this. detailsHere is my benchmark script: https://gist.github.com/trentm/ba426e5a08317b18d40e897aeb536c0c And a run:
However, this is all fast enough, so I'm not proposing doing any WildcardMatcher perf improvements right now. |
examples/trace-elasticsearch7.js
Outdated
@@ -18,6 +18,8 @@ const apm = require('../').start({ // elastic-apm-node | |||
logUncaughtExceptions: true | |||
}) | |||
|
|||
// Note that version *8* is installed by default. To use v7 you'll need to: |
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.
nit: Might be better to say version 7 is not installed by default instead of Note that version 8 is installed by default, since the later will inevitably be not true one day but the former will almost certainly be true into the future.
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.
Sounds good to me, thanks.
Note, if interested: For a while I'd had both v7 and v8 installed using an alias for v7 -- "@elastic/elasticsearch7": "npm:@elastic/[email protected]"
. However the default npm in node v8 doesn't support that alias syntax, so I dropped it.
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.
commit f8631c0
@@ -249,6 +249,7 @@ declare namespace apm { | |||
contextPropagationOnly?: boolean; | |||
disableInstrumentations?: string | string[]; | |||
disableSend?: boolean; | |||
elasticsearchCaptureBodyUrls?: Array<string>; |
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.
No objection, but why Array<string>
instead of string[]
?
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.
Honestly just copying syntax from elsewhere in this file. https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays says both are fine and doesn't claim a preference, so I'm fine with either way. Both are used in index.d.ts.
@@ -10,64 +10,50 @@ | |||
// - elasticsearch - the legacy Elasticsearch JS client | |||
// - @elastic/elasticsearch - the new Elasticsearch JS client | |||
|
|||
const querystring = require('querystring') |
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.
👍 dings the "two require('querystring')
references left before we can drop another dep." bell 🛎️
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
[email protected] is release with this now |
This adds a new config option, per the 'elasticsearch_capture_body_urls' cross-agent spec, to control for which ES client requests the request body is captured. By default it is just the body of search-related APIs. The use case for configuring this is to capture for *all* requests for reply in Kibana performance work. This option is not expected to be used often.
This adds a new config option, per the
'elasticsearch_capture_body_urls' cross-agent spec, to control for which
ES client requests the request body is captured. By default it is just
the body of search-related APIs. The use case for configuring this is
to capture for all requests for reply in Kibana performance work. This
option is not expected to be used often.
Closes: #2880
Closes: #2019
Refs: elastic/apm#665
Refs: elastic/apm#670
checklist