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

Fresh results #34

Merged
merged 6 commits into from
Aug 27, 2019
Merged

Fresh results #34

merged 6 commits into from
Aug 27, 2019

Conversation

jeqo
Copy link
Collaborator

@jeqo jeqo commented Aug 27, 2019

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.

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
Copy link
Collaborator Author

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());
Copy link
Collaborator Author

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.

@jeqo jeqo merged commit 096831a into master Aug 27, 2019
Copy link
Contributor

@codefromthecrypt codefromthecrypt left a 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()) {
Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#35

});
}
} else {
while (checkpoint > from && traces.size() < request.limit()) {
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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)
Copy link
Contributor

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..

Copy link
Collaborator Author

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.

@jeqo jeqo deleted the fresh-results branch August 28, 2019 07:40
@jeqo
Copy link
Collaborator Author

jeqo commented Aug 28, 2019

@adriancole , I'd love to move it to oz-contrib!

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.

Get traces returns older results
2 participants