-
Notifications
You must be signed in to change notification settings - Fork 482
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
fix2308: Add query parameter to Search API to configure spans-per-span-set in response #2411
Conversation
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.
This is looking good but we need a few tweaks before we can get it in. A few other things
- needs a changelog
- vendor-check is failing. try running
make gen-proto
locally. you can also runmake vendor-check
locally to make sure things are in order. - please add the new query param here: https://github.com/grafana/tempo/blob/main/docs/sources/tempo/api_docs/_index.md?plain=1#L158
If you have noticed CI is a mess at the moment. We are working on it, but for now if things are passing locally feel free to submit and i will rerun CI.
Thanks for giving this a shot!
cmd/tempo-serverless/handler.go
Outdated
@@ -110,7 +110,7 @@ func Handler(r *http.Request) (*tempopb.SearchResponse, *HTTPError) { | |||
var resp *tempopb.SearchResponse | |||
|
|||
if api.IsTraceQLQuery(searchReq.SearchReq) { | |||
engine := traceql.NewEngine() | |||
engine := traceql.NewEngineWithSpansPerSpanSet(int(searchReq.SearchReq.SpansPerSpanSet)) |
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.
Let's have NewEngine()
take the spans per spanset parameter instead of making a new method. There are 2 places in instance_search
that will also need this parameter for it to work.
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.
I see three invocations of NewEngine in instance_search, 2 of which have access to request. This one doesn't have, so I guess I can pass default value of 3 here.
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.
I looked a little deeper and I'm wondering why we don't just use the value on the searchReq
? We pass it in when we call ExecuteSearch
. Can't we just the value on that struct?
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.
You mean to add spanperspanset field in SearchBlockRequest instead of SearchRequest?
I have made the changes as suggested above. But engine_test:TestEngine_Execute still fails because what filter function does is not reflected in the final response, for eactly the same reason as discussed here. |
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.
I have made the changes as suggested above. But engine_test:TestEngine_Execute still fails because what filter function does is not reflected in the final response, for eactly the same reason as discussed #2307.
This should work though b/c every span returned by the filter function is decorated with metadata by the second pass of the fetch layer. I don't think we'll have the same issue here.
cmd/tempo-serverless/handler.go
Outdated
@@ -110,7 +110,7 @@ func Handler(r *http.Request) (*tempopb.SearchResponse, *HTTPError) { | |||
var resp *tempopb.SearchResponse | |||
|
|||
if api.IsTraceQLQuery(searchReq.SearchReq) { | |||
engine := traceql.NewEngine() | |||
engine := traceql.NewEngineWithSpansPerSpanSet(int(searchReq.SearchReq.SpansPerSpanSet)) |
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.
I looked a little deeper and I'm wondering why we don't just use the value on the searchReq
? We pass it in when we call ExecuteSearch
. Can't we just the value on that struct?
Now I understand the cause of the test failure. Its down to the way we are using those filtered spans in mocked iterator defined in engine_test. There we seem to be not correctly assigning them to the response.
I think we need to assign only those spans which are now in ss as it represents the filtered result. PS: SpanSet has a field 'Matched' which I understand represents the matching spans found in the storage. We are populating this field here
spanset represents the filtered result. So it seems, Matched is just the number of spans left after filtering(filtering involves query conditions + taking only number of spans as per spansPerSpanSet configuration). So Matched is actually not exactly the number of spans matched in storage. |
Test failures here made me to try to run tests locally, and I see many test failures in e2e, wal, OTHERS etc. Need to look in more details why those failures happening. It may take some more time as make tasks are not running out of box in windows. I may have to check those tests one-by-one. |
Right, this is what you were looking at fixing previously, but it is going to require some additional work that I was going to do anyway when implementing grouping and select. It's on the list to fix!
Yeah, our CI is not great at the moment. @mapno is looking into cleaning it up some. |
It would be really helpful if makefile can be made window compatible. |
manish chandra ghildiyal seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Have you considered using WSL for development? There also is a vscode plugin to seamlessly develop using WSL. I have not tried it myself as I don't have a windows environment - but it looks worth trying. |
Yeah, I tried with WSL, but things become pretty slow with it. |
The UI will not automatically update for added query parameters. Once this PR is in we will submit an issue in the grafana repo to support the new param. If you are interested in working on it, you'd be more than welcome to. If not, the team will get to it when they can. |
Ok, got it. Yup, I am interested on Grafana UI work. |
There is one change I'd like you to make. Let's remove the parameter from There's no need to construct the engine with this value since we're already passing it into the only place that uses it. Also, double check the output of "Vendor Check". It looks like proto generation is having issues. |
So I was able to run vendor-check locally, courtesy input I got on Slack channel. |
89d6072
to
3d0ded3
Compare
@@ -72,8 +69,9 @@ func (e *Engine) ExecuteSearch(ctx context.Context, searchReq *tempopb.SearchReq | |||
|
|||
// reduce all evalSS to their max length to reduce meta data lookups | |||
for i := range evalSS { | |||
if len(evalSS[i].Spans) > e.spansPerSpanSet { | |||
evalSS[i].Spans = evalSS[i].Spans[:e.spansPerSpanSet] | |||
spansPerSpanSet := int(searchReq.SpansPerSpanSet) |
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.
tests are breaking b/c they are passing in 0 for this value and it is truncating all responses. i think if the value is 0 here we should default to 3.
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.
I was planning to update requests created in testAdvancedTraceQLCompleteBlock. Seems updating above code is a better solution.
I am not able to reproduce failure of test-with-cover-others locally. |
test-with-cover-tempodb seems to be flaky. Sometimes it fails, sometimes not. |
I am not sure why it shows so, but I have signed CLA few times. |
The job is not even kicking off. It has nothing to do with whether or not you've signed the CLA. One option is to push an empty commit and see if that kick starts it. Otherwise we can wait for it to give up and force restart it. As long as its pending I can't do anything. |
I can debug it. |
Summary of changes:
Adds a query parameter to Search API to make spans-per-span-set in response configurable:
Fixes #2308
Checklist