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

Updating the ReporterConfig to set Sender Correctly #370

Merged

Conversation

natehart
Copy link
Contributor

A small bug in the private getReporter(..) method was resulting in the sender
always being set to the default UdpSender. This is because the field
senderConfiguration.sender is null until the getSender() method is called on
it. Because the reporter builder was accessing the field directly rather than
through the getter, it was always UdpSen a null sender, thus defaulting to the
UdpSender even if the JAEGER_ENDPOINT property was set.

This commit fixes the problem, accessing the configured sender through the
appropriate getter, allowing the user configurations to propagate through to the
tracer retrieved via the Configuration.fromEnv().getTracer() method.

Signed-off-by: Nate Hart nhart@tableau.com

A small bug in the private getReporter(..) method was resulting in the sender
always being set to the default UdpSender. This is because the field
`senderConfiguration.sender` is null until the `getSender()` method is called on
it. Because the reporter builder was accessing the field directly rather than
through the getter, it was always UdpSen a null sender, thus defaulting to the
UdpSender even if the JAEGER_ENDPOINT property was set.

This commit fixes the problem, accessing the configured sender through the
appropriate getter, allowing the user configurations to propagate through to the
tracer retrieved via the `Configuration.fromEnv().getTracer()` method.

Signed-off-by: Nate Hart <nhart@tableau.com>
@codecov
Copy link

codecov bot commented Mar 15, 2018

Codecov Report

Merging #370 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #370      +/-   ##
===========================================
+ Coverage     84.46%   84.5%   +0.04%     
  Complexity      619     619              
===========================================
  Files            95      95              
  Lines          2459    2459              
  Branches        274     274              
===========================================
+ Hits           2077    2078       +1     
+ Misses          285     284       -1     
  Partials         97      97
Impacted Files Coverage Δ Complexity Δ
...e/src/main/java/com/uber/jaeger/Configuration.java 89.96% <100%> (+0.32%) 37 <0> (ø) ⬇️

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 368bf5a...c47b632. Read the comment docs.

@@ -570,7 +570,7 @@ public ReporterConfiguration withSender(SenderConfiguration senderConfiguration)
private Reporter getReporter(Metrics metrics) {
Reporter reporter = new RemoteReporter.Builder()
.withMetrics(metrics)
.withSender(senderConfiguration.sender)
.withSender(senderConfiguration.getSender())
Copy link
Member

Choose a reason for hiding this comment

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

oh, come on, Java, it's a private field, why is it visible to a class defined at the same level?

@yurishkuro
Copy link
Member

thanks @natehart

cc @pavolloffay

Copy link
Collaborator

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

LGTM, but I would be really happy if you added a test case to demonstrate the bug.

@yurishkuro yurishkuro merged commit ee137d6 into jaegertracing:master Mar 16, 2018
@pavolloffay
Copy link
Member

@jpkrohling could you please cut a micro release with this change?

@natehart natehart deleted the bugfix/natehart/sender_configuration branch March 19, 2018 19:07
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