-
Notifications
You must be signed in to change notification settings - Fork 219
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
Truncate long sql queries to prevent oversized events to APM server #842
Conversation
@beniwohli I'm unsure of how to test this. We don't test the Any thoughts? |
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.
Regarding testing, you could use mock
to change the value of KEYWORD_MAX_LENGTH
to a very low value, so we don't need a super long query. Or just do a "SELECT xyz from test_table WHERE xyz = %s" % ("x" * 10010)
. I think testing with SQLite only is fine.
Excellent advice, thanks @beniwohli. This is ready for review. |
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.
LGTM, nice work!
…lastic#842) * Truncate long sql queries to prevent oversized events to APM server * Truncate sql to 10000 characters instead of keyword length * Add a test * Add to changelog * Add encoding for sqlite_tests.py * Use existing `shorten()` instead of `truncate()`
…lastic#842) * Truncate long sql queries to prevent oversized events to APM server * Truncate sql to 10000 characters instead of keyword length * Add a test * Add to changelog * Add encoding for sqlite_tests.py * Use existing `shorten()` instead of `truncate()`
…lastic#842) * Truncate long sql queries to prevent oversized events to APM server * Truncate sql to 10000 characters instead of keyword length * Add a test * Add to changelog * Add encoding for sqlite_tests.py * Use existing `shorten()` instead of `truncate()`
APM server allows events with a max size of 10000 characters. Shorten queries traced in asyncpg to max allowed. See: elastic#842
* Shorten long SQL query to prevent oversized event APM server allows events with a max size of 10000 characters. Shorten queries traced in asyncpg to max allowed. See: #842 * Fix copied SQL * fix test * instrument for test * move changelog entry to "Unreleased" and fix PR number Co-authored-by: Benjamin Wohlwend <beni@elastic.co>
Fixes #827