-
Notifications
You must be signed in to change notification settings - Fork 231
Updating the ReporterConfig to set Sender Correctly #370
Updating the ReporterConfig to set Sender Correctly #370
Conversation
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 Report
@@ 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
Continue to review full report at Codecov.
|
@@ -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()) |
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.
oh, come on, Java, it's a private field, why is it visible to a class defined at the same level?
thanks @natehart cc @pavolloffay |
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.
LGTM, but I would be really happy if you added a test case to demonstrate the bug.
@jpkrohling could you please cut a micro release with this change? |
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 thegetSender()
method is called onit. 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