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

feat(pipeline): Capture Trace flag #2293

Merged
merged 13 commits into from
Dec 16, 2021
Merged

Conversation

rahul-kumar-saini
Copy link
Contributor

Overview

  • We need a flag to know whether or not to capture the ClickHouse trace
  • This comes in through RequestSettings and gets propagated through to query execution
  • The flag currently isn't used to do anything but it is required for future changes to capture and return ClickHouse tracing data when needed through the admin portal

Changes

  • Added capture_trace flag to RequestSettings and schema
  • Updated execution pipeline to propagate flag through to ClickHouse execute() methods

evanh and others added 10 commits December 14, 2021 14:26
It is very difficult to capture new data from Clickhouse with the current return
value from the function. The current wrapper around the clickhouse-driver
library returns a simple list of results, that gets overloaded with column types
when that meta information is returned. Change the return type to be an object,
so that any data that we might want to propogate up from Clickhouse becomes easy
to add without having to go through this process again.
@rahul-kumar-saini rahul-kumar-saini requested a review from a team as a code owner December 16, 2021 15:49
@volokluev
Copy link
Member

So this means that technically any snuba API call can request a trace. Is that what we want? Are there any dangers in exposing this functionality to all callers?

@onewland
Copy link
Contributor

Is there any reason to separate the change where it gets wired through?

@rahul-kumar-saini
Copy link
Contributor Author

Right, the flag needs to be passed via the API request but I'm unsure how to make it so only the admin portal can use it.

@onewland This doesn't need to be a separate PR but I'd like to figure out how to limit the exposure of the flag in the API and we can work on using it later.

Copy link
Member

@evanh evanh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test for this? Maybe add a test to one of the *_api.py tests to make sure that adding the field doesn't break anything.

@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2021

Codecov Report

Merging #2293 (6a4f860) into master (b9198f8) will decrease coverage by 0.00%.
The diff coverage is 90.90%.

❗ Current head 6a4f860 differs from pull request most recent head e3bd4e7. Consider uploading reports for the commit e3bd4e7 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2293      +/-   ##
==========================================
- Coverage   92.96%   92.96%   -0.01%     
==========================================
  Files         556      556              
  Lines       25436    25447      +11     
==========================================
+ Hits        23646    23656      +10     
- Misses       1790     1791       +1     
Impacted Files Coverage Δ
snuba/clickhouse/native.py 79.10% <ø> (ø)
snuba/reader.py 91.83% <ø> (ø)
snuba/request/schema.py 72.88% <ø> (ø)
snuba/web/db_query.py 88.50% <ø> (ø)
tests/clusters/fake_cluster.py 86.00% <ø> (ø)
snuba/request/request_settings.py 84.52% <87.50%> (+0.31%) ⬆️
tests/test_snql_api.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9198f8...e3bd4e7. Read the comment docs.

@rahul-kumar-saini rahul-kumar-saini enabled auto-merge (squash) December 16, 2021 20:36
@rahul-kumar-saini rahul-kumar-saini merged commit 397bc0e into master Dec 16, 2021
@rahul-kumar-saini rahul-kumar-saini deleted the feat/capture-tracing-flag branch December 16, 2021 20:42
lynnagara pushed a commit that referenced this pull request Dec 16, 2021
Added capture_trace flag to RequestSettings and schema
Updated execution pipeline to propagate flag through to ClickHouse execute() methods
Comment on lines +136 to +139
# Flag to retrieve only ClickHouse tracing data. If this is True,
# the query execution should not return the results of the query, but
# return the tracing data of the query execution within ClickHouse
"capture_trace": {"type": "boolean", "default": False},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we want to expose this in the snuba api.
We cannot change the log handler there if that impacts the system logs or snuba logs, which means we would not be using this in that circumstance.
Also this may not work in HTTP and we want to move away from the TCP protocol for the Snuba queries, which may mean this will not be able to work on the snuba api.

I would suggest we remove it from there till we do not decide to expose it.

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

Successfully merging this pull request may close these issues.

6 participants