-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fresh results #34
Fresh results #34
Conversation
traces.add(spans); | ||
long from = (request.endTs() - request.lookback()) * 1000; | ||
long to = request.endTs() * 1000; | ||
long checkpoint = to - (30 * 1000 * 1000); // 30 sec before upper bound |
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 checkpoint represent the bucket range
LOG.debug("Traces found from query {}: {}", queryRequest, traces.size()); | ||
return traces; | ||
} | ||
traces.sort(Comparator.<List<Span>>comparingLong(o -> o.get(0).timestampAsLong()).reversed()); |
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.
Resulting traces list should have values close to limit
, so sorting should not be expensive.
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.
really coming along.. starting to wonder if this makes sense for oz-contrib so we can help publishing it?
// double check service names are unique | ||
if (!serviceNames.contains(keyValue.value)) serviceNames.add(keyValue.value); | ||
}); | ||
try (KeyValueIterator<String, String> all = serviceStore.all()) { |
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.
sheesh do we allow dupes? sounds like we should tighten up that javadoc
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.
yeap, that surprise me on one of my deployments where I started to get duplicate service names. Will create an issue to double check this.
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.
}); | ||
} | ||
} else { | ||
while (checkpoint > from && traces.size() < request.limit()) { |
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.
cc @llinder @michaelsembwever this seems familiar though in cassandra I think we try to do async lazy chained calls.. not sure if the traceIdsByTsStore.range
here is a remote call or not.
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.
All stores are local tho
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.
Unless we'd support openzipkin/zipkin#2784 where calls could span multiple instances
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.
Issue moved to #36
} | ||
return traces.size() == 1 | ||
&& traces.get(0).size() == 1; // last trace is returned first | ||
}); | ||
await().atMost(5, TimeUnit.SECONDS) |
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.
side question.. why all the waits? I know in some cases you can't get a callback of storage quorum met. in such case you could add a sleep to a command that wraps storage to declutter the IT's main code..
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.
Good question, probably copy-pasta heh. I think only first one is needed, will clean up.
@adriancole , I'd love to move it to oz-contrib! |
Fix #33
This PR includes an attempt to solve the "return oldest" issue by creating a bucketed range query procedure and validate on every bucket if we have enough traces to return a result, instead of testing every trace on request range, or return first results.