Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Avoid direct access to apache thrift from jaeger-core via transitive … #374

Merged
merged 5 commits into from
Apr 6, 2018

Conversation

objectiser
Copy link
Contributor

…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

@ghost ghost assigned objectiser Apr 4, 2018
@ghost ghost added the review label Apr 4, 2018
@codecov
Copy link

codecov bot commented Apr 4, 2018

Codecov Report

Merging #374 into master will increase coverage by 0.16%.
The diff coverage is 86.2%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...c/main/java/com/uber/jaeger/senders/UdpSender.java 77.77% <100%> (+4.44%) 5 <2> (ø) ⬇️
...ain/java/com/uber/jaeger/senders/ThriftSender.java 75% <80%> (+1.53%) 10 <3> (ø) ⬇️
.../main/java/com/uber/jaeger/senders/HttpSender.java 90.47% <88.88%> (+0.47%) 8 <2> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c927b80...3df898d. Read the comment docs.

}

@Override
public void send(Process process, List<Span> spans) throws TException {
public void send(Process process, List<Span> spans) throws Exception {
Copy link
Collaborator

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?

Copy link
Contributor Author

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

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

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

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

Copy link
Contributor Author

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

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.

Copy link
Contributor Author

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.

@vprithvi
Copy link
Contributor

vprithvi commented Apr 4, 2018

Semi related question: Does it make sense to move the senders and transports that depend on thrift to the jaeger-thrift package also (Keeping only the base Sender interface in jaeger-core)?
This way, the transport layer becomes easier to manage from a dependency management perspective (and allow for easy migration to things like grpc, etc)

@objectiser
Copy link
Contributor Author

@vprithvi Did think about this change initially, but the problem is that the senders use classes in jaeger-core (e.g. com.uber.jaeger.Span) so would result in circular dependency.

@objectiser
Copy link
Contributor Author

@vprithvi Are you ok with the changes? Would be good to get this one merged.

@vprithvi
Copy link
Contributor

vprithvi commented Apr 5, 2018

LGTM!

Did think about this change initially, but the problem is that the senders use classes in jaeger-core (e.g. com.uber.jaeger.Span) so would result in circular dependency.

This is unfortunate

@ghost ghost assigned jpkrohling Apr 6, 2018
…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>
@jpkrohling jpkrohling removed their assignment Apr 6, 2018
Signed-off-by: Gary Brown <gary@brownuk.com>
Signed-off-by: Gary Brown <gary@brownuk.com>
@jpkrohling jpkrohling merged commit 6d822c3 into jaegertracing:master Apr 6, 2018
@ghost ghost removed the review label Apr 6, 2018
@objectiser objectiser deleted the thrift branch April 6, 2018 09:44
Compact
}

public static final int EMIT_BATCH_OVERHEAD = 33;
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

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?

Copy link
Contributor Author

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants