-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Makes SpanBytesDecoder work on ByteBuffer #2589
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
033f96f
Makes SpanBytesDecoder work on ByteBuffer
e4f39b0
whoops forgot the important parts
7c66891
de-optimizes for thrift in order to increase clarity
a775378
bug
1ebab4b
Adds json comparison benchmarks
014e985
just review feedback
a4331ac
mah endian
ad344eb
less code
b045e2a
bench
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
benchmarks/src/main/java/zipkin2/internal/UnsafeBufferBenchmarks.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import zipkin2.internal.FilterTraces; | ||
import zipkin2.internal.HexCodec; | ||
import zipkin2.internal.Nullable; | ||
import zipkin2.internal.ReadBuffer; | ||
import zipkin2.internal.V1ThriftSpanReader; | ||
import zipkin2.storage.GroupByTraceId; | ||
import zipkin2.storage.QueryRequest; | ||
|
@@ -59,11 +60,11 @@ static class Factory { | |
this.accumulateSpans = new DecodeAndConvertSpans(); | ||
|
||
this.preparedStatement = | ||
session.prepare( | ||
QueryBuilder.select("trace_id", "span") | ||
.from("traces") | ||
.where(QueryBuilder.in("trace_id", QueryBuilder.bindMarker("trace_id"))) | ||
.limit(QueryBuilder.bindMarker("limit_"))); | ||
session.prepare( | ||
QueryBuilder.select("trace_id", "span") | ||
.from("traces") | ||
.where(QueryBuilder.in("trace_id", QueryBuilder.bindMarker("trace_id"))) | ||
.limit(QueryBuilder.bindMarker("limit_"))); | ||
this.maxTraceCols = maxTraceCols; | ||
this.strictTraceId = strictTraceId; | ||
this.groupByTraceId = GroupByTraceId.create(strictTraceId); | ||
|
@@ -72,8 +73,8 @@ static class Factory { | |
Call<List<Span>> newCall(String hexTraceId) { | ||
long traceId = HexCodec.lowerHexToUnsignedLong(hexTraceId); | ||
Call<List<Span>> result = | ||
new SelectFromTraces(this, Collections.singleton(traceId), maxTraceCols) | ||
.flatMap(accumulateSpans); | ||
new SelectFromTraces(this, Collections.singleton(traceId), maxTraceCols) | ||
.flatMap(accumulateSpans); | ||
return strictTraceId ? result.map(StrictTraceId.filterSpans(hexTraceId)) : result; | ||
} | ||
|
||
|
@@ -95,7 +96,7 @@ FlatMapper<Set<Long>, List<List<Span>>> newFlatMapper(QueryRequest request) { | |
@Override | ||
protected ResultSetFuture newFuture() { | ||
return factory.session.executeAsync( | ||
factory.preparedStatement.bind().setSet("trace_id", trace_id).setInt("limit_", limit_)); | ||
factory.preparedStatement.bind().setSet("trace_id", trace_id).setInt("limit_", limit_)); | ||
} | ||
|
||
@Override public ResultSet map(ResultSet input) { | ||
|
@@ -139,9 +140,9 @@ public Call<List<List<Span>>> map(Set<Long> input) { | |
traceIds = input; | ||
} | ||
Call<List<List<Span>>> result = | ||
new SelectFromTraces(factory, traceIds, factory.maxTraceCols) | ||
.flatMap(factory.accumulateSpans) | ||
.map(factory.groupByTraceId); | ||
new SelectFromTraces(factory, traceIds, factory.maxTraceCols) | ||
.flatMap(factory.accumulateSpans) | ||
.map(factory.groupByTraceId); | ||
return filter != null ? result.map(filter) : result; | ||
} | ||
|
||
|
@@ -163,7 +164,7 @@ protected BiConsumer<Row, List<Span>> accumulator() { | |
return (row, result) -> { | ||
V1ThriftSpanReader reader = V1ThriftSpanReader.create(); | ||
V1SpanConverter converter = V1SpanConverter.create(); | ||
V1Span read = reader.read(row.getBytes("span")); | ||
V1Span read = reader.read(ReadBuffer.wrapUnsafe(row.getBytes("span"))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here cassandra is using the bytebuffer variant directly |
||
converter.convert(read, result); | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
here is us decoding directly the bytebuffer in benchmarks