Skip to content

What information does Flask-SQLAlchemy send? #33

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

Closed
harveyslash opened this issue Mar 6, 2018 · 9 comments
Closed

What information does Flask-SQLAlchemy send? #33

harveyslash opened this issue Mar 6, 2018 · 9 comments

Comments

@harveyslash
Copy link

I would like to get the actual queries that are being executed along with the time it took to execute them.

Right now the most informative text that I can see is
sqlalchemy.orm.query.one (indicating that i performed a one() query)

Is there any way to get actual sql query data , or the queries itself ?

@haotianw465
Copy link
Contributor

The actual query string capture was originally in the PR submitted by @therealryanbonham, but we requested that part of logic to be removed and submitted with a separate PR.

The actual query might contain sensitive user information and we will have to require the query capture PR to be sanitized and reviewed by our security team to make sure no sensitive user data can sneak into the captured data.

We haven't receive the separate PR yet but I will ping @therealryanbonham to check if there is any recent plan on the query capture.

@harveyslash
Copy link
Author

can you link me to that PR ?
I dont mind having some sensitive information being sent.
I would like to see if I can use X ray for my application right now.

@haotianw465
Copy link
Contributor

Yes sorry I forget to put that link on. #14

@haotianw465
Copy link
Contributor

Hi @harveyslash just want to let you know that the PR for query capture is submitted: #34. Please feel free to try it out and provide any feedback under that PR.

@harveyslash
Copy link
Author

I installed that using:
pip install --upgrade git+https://github.com/therealryanbonham/aws-xray-sdk-python.git

And it doesnt seem to have changed anything.

I am not getting the actual query in my X-ray console

@therealryanbonham
Copy link
Contributor

@harveyslash
Copy link
Author

just tried the branch, now im getting :

File "venv/beatest-flask-rest-backend-36/lib/python3.6/site-packages/aws_xray_sdk/core/emitters/udp_emitter.py", line 55, in _send_data
self._port))
OSError: [Errno 40] Message too long

And my X-ray console doesnt show the requests that had the message too long error.
I about 15 fields in my table, so the sql query could be fairly long

@haotianw465
Copy link
Contributor

The default UDP packet size is usually 64KB but it might vary on different OS. You can consider to increase this limit.

You can also change streaming_threshold to a lower value so that some data is streamed out earlier:
xray_recorder.configure(streaming_threshold=10)

See https://github.com/aws/aws-xray-sdk-python/blob/master/aws_xray_sdk/core/recorder.py#L118. The default value is 30 which means a segment will stream out its children subsegments when the total children count reaches 30. You can change to 10 or even lower to fit your use case.

@haotianw465
Copy link
Contributor

Since the PR for query capture is already out #34, I will close this in favor of the PR to make sure we have a single place to track feedback, concerns and progress regarding this new feature.

If you have other questions regarding the SDK usage in general, feel free to post on our forum https://forums.aws.amazon.com/forum.jspa?forumID=241 or open new issues. But feel free to leave any comments here if you still have concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants