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

Expose Max Db Statement Size as a Config Option #1921

Closed
gingerwizard opened this issue Dec 17, 2020 · 6 comments · Fixed by #2193
Closed

Expose Max Db Statement Size as a Config Option #1921

gingerwizard opened this issue Dec 17, 2020 · 6 comments · Fixed by #2193
Assignees
Labels
agent-nodejs Make available for APM Agents project planning. enhancement kibana
Milestone

Comments

@gingerwizard
Copy link

Currently the span.context.db.statement is limited to 10000 characters after which truncation occurs. This limit is easily exceeded on REST API based dbs that use JSON e.g. Elasticsearch. Proposal is to make this configurable similar tothe truncation limit for error messages.

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Dec 17, 2020
@gingerwizard
Copy link
Author

Note is particularly important when debugging requests to Elasticsearch from Kibana.

@trentm trentm self-assigned this Dec 17, 2020
@trentm
Copy link
Member

trentm commented Dec 17, 2020

A temporary work around is to apply this patch to one's node_modules/elastic-apm-node/lib/config.js:

diff --git a/lib/config.js b/lib/config.js
index 38d6408..a5520b0 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -257,6 +257,8 @@ class Config {
           // Sanitize conf
           truncateKeywordsAt: config.INTAKE_STRING_MAX_SIZE,
           truncateErrorMessagesAt: conf.errorMessageMaxLength,
+          // XXX
+          truncateQueriesAt: 20000,
           // HTTP conf
           secretToken: conf.secretToken,

@trentm trentm added this to the 7.13 milestone Mar 18, 2021
@trentm
Copy link
Member

trentm commented Mar 18, 2021

^^ proposing this for 7.13. Currently Dale is having "to maintain a fork for tests and any automation" for his es rally work.

@AlexanderWert AlexanderWert modified the milestones: 7.13, 7.15 Jun 16, 2021
@trentm
Copy link
Member

trentm commented Jun 16, 2021

Notes to self:

  • perhaps do this together with changes to db.statement format for ES: Reconsider structure of context.db.statement #2019
  • tracing-instrumentation-db.md spec says "We store up to 10000 Unicode characters per database statement." FWIW
  • TODO: verify if >10k gets stored in ES docs or if apm-server clips or rejects. I don't (with a quick naive look) see clipping/length limiting in apm-server for this field.

trentm added a commit that referenced this issue Aug 13, 2021
Before this the 10000 length truncation of the "query" field for
database spans was hardcoded.

Fixes: #1921
@trentm trentm modified the milestones: 7.15, 7.16 Aug 16, 2021
trentm added a commit that referenced this issue Sep 3, 2021
…MaxLength` (#2193)

This config option will truncate some transaction, span, and error fields
that can be longer at the configured number of JavaScript characters per
https://github.com/elastic/apm/blob/master/specs/agents/field-limits.md#long_field_max_length-configuration

Notably truncation is now based on a count of JavaScript *characters*
rather than in UTF-8 encoded bytes.

This also deprecates the errorMessageMaxLength config option. It now
defaults to the longFieldMaxLength value if not specified. Otherwise
errorMessageMaxLength is still supported.

Fixes: #1921
@trentm
Copy link
Member

trentm commented Sep 3, 2021

@gingerwizard Once we publish an agent release with this change you'll be able to set the truncation limie for span.context.db.statement via the longFieldMaxLength: <number> config var. I try to post here again once we have that release.

dgieselaar pushed a commit to dgieselaar/apm-agent-nodejs that referenced this issue Sep 10, 2021
…MaxLength` (elastic#2193)

This config option will truncate some transaction, span, and error fields
that can be longer at the configured number of JavaScript characters per
https://github.com/elastic/apm/blob/master/specs/agents/field-limits.md#long_field_max_length-configuration

Notably truncation is now based on a count of JavaScript *characters*
rather than in UTF-8 encoded bytes.

This also deprecates the errorMessageMaxLength config option. It now
defaults to the longFieldMaxLength value if not specified. Otherwise
errorMessageMaxLength is still supported.

Fixes: elastic#1921
@trentm
Copy link
Member

trentm commented Sep 15, 2021

@gingerwizard If it helps for https://github.com/elastic/rally-internal-tracks/issues/119 [email protected] has now been released that includes longFieldMaxLength to allow you to increase the max size for span.context.db.statement.

astorm pushed a commit that referenced this issue Oct 4, 2021
…MaxLength` (#2193)

This config option will truncate some transaction, span, and error fields
that can be longer at the configured number of JavaScript characters per
https://github.com/elastic/apm/blob/master/specs/agents/field-limits.md#long_field_max_length-configuration

Notably truncation is now based on a count of JavaScript *characters*
rather than in UTF-8 encoded bytes.

This also deprecates the errorMessageMaxLength config option. It now
defaults to the longFieldMaxLength value if not specified. Otherwise
errorMessageMaxLength is still supported.

Fixes: #1921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning. enhancement kibana
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants