-
Notifications
You must be signed in to change notification settings - Fork 231
Avoid direct access to apache thrift from jaeger-core via transitive … #374
Conversation
Codecov Report
@@ Coverage Diff @@
## master #374 +/- ##
============================================
+ Coverage 84.56% 84.73% +0.16%
+ Complexity 621 607 -14
============================================
Files 95 94 -1
Lines 2468 2410 -58
Branches 276 271 -5
============================================
- Hits 2087 2042 -45
+ Misses 284 276 -8
+ Partials 97 92 -5
Continue to review full report at Codecov.
|
} | ||
|
||
@Override | ||
public void send(Process process, List<Span> spans) throws TException { | ||
public void send(Process process, List<Span> spans) throws Exception { |
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.
Is it possible to have a more specialized exception?
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.
Actually I think it could be changed to SenderException
- will give it a go.
@@ -0,0 +1,87 @@ | |||
/* | |||
* Copyright (c) 2016-2018, Uber Technologies, Inc |
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.
s/Uber Technologies, Inc/The Jaeger Authors/
@@ -0,0 +1,67 @@ | |||
/* | |||
* Copyright (c) 2016-2018, Uber Technologies, Inc |
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.
s/Uber Technologies, Inc/The Jaeger Authors/
int a = calculateBatchOverheadDifference(1); | ||
int b = calculateBatchOverheadDifference(2); | ||
|
||
// This value has been empirically observed to be 56. |
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 know it's just a code being moved from the old test to the new one, but is this comment accurate? Which value is it referring to? If it's EMIT_BATCH_OVERHEAD
, then it's 33, not 56...
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.
Yeah noticed that too - but wanted to preserve what was already there.
@yurishkuro ok to update the comment, as it looks like it should be 33?
try { | ||
agentClient.emitBatch(new Batch(process, spans)); | ||
} catch (Exception e) { | ||
throw new SenderException(String.format("Could not send %d spans", spans.size()), e, 1); |
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 think the last parameter needs to be spans.size().
That being said, I don't like constructor for SenderException
. It seems in most of the usages, the spans dropped is mentioned as part of the string in the first parameter. This could be an opportunity to refactor the API to be more friendly.
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.
Fixed. Could be refactored, although the dropped span count is currently used in ThriftSender
- so not sure whether having access to the count has other uses.
Semi related question: Does it make sense to move the senders and transports that depend on thrift to the |
@vprithvi Did think about this change initially, but the problem is that the senders use classes in |
@vprithvi Are you ok with the changes? Would be good to get this one merged. |
LGTM!
This is unfortunate |
…dependency through jaeger-thrift. Signed-off-by: Gary Brown <gary@brownuk.com>
…t and other comment Signed-off-by: Gary Brown <gary@brownuk.com>
Signed-off-by: Gary Brown <gary@brownuk.com>
Signed-off-by: Gary Brown <gary@brownuk.com>
Signed-off-by: Gary Brown <gary@brownuk.com>
Compact | ||
} | ||
|
||
public static final int EMIT_BATCH_OVERHEAD = 33; |
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 value is dependent on the protocol
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.
Will take a look at this.
@@ -17,67 +17,52 @@ | |||
import com.uber.jaeger.Span; | |||
import com.uber.jaeger.exceptions.SenderException; | |||
import com.uber.jaeger.reporters.protocols.JaegerThriftSpanConverter; | |||
import com.uber.jaeger.reporters.protocols.ThriftUdpTransport; | |||
import com.uber.jaeger.thrift.reporters.protocols.ThriftUdpTransport; | |||
import com.uber.jaeger.thrift.senders.ThriftSenderBase; |
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 am not sure I fully understand this change. Don't these imports still retain the dependency on jaeger-thrift?
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.
Yes there is still a dependency from core to jaeger-thrift. This PR was about removing direct use of apache thrift from core, as a dependency leak.
More work is required to make a true transport abstraction. Is this something also for 1.0?
…dependency through jaeger-thrift.
Fixes #228
Aim is to minimise changes while removing all direct usage of Apache Thrift from jaeger-core.
Signed-off-by: Gary Brown gary@brownuk.com