-
Notifications
You must be signed in to change notification settings - Fork 232
Polish configuration API #411
Polish configuration API #411
Conversation
Codecov Report
@@ Coverage Diff @@
## master #411 +/- ##
============================================
+ Coverage 82.24% 82.33% +0.09%
- Complexity 487 490 +3
============================================
Files 66 66
Lines 2033 2044 +11
Branches 247 247
============================================
+ Hits 1672 1683 +11
+ Misses 280 279 -1
- Partials 81 82 +1
Continue to review full report at Codecov.
|
public CodecConfiguration() { | ||
} | ||
|
||
public CodecConfiguration withCodec(Format<?> format, Codec<TextMap> codec) { |
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.
Yay!!
A note, not necessary on this PR as I can open a separate issue, the |
@aaronkorver you can call |
right, but I can't call the parser function in Configuration as it is private right now. I have some teams that want to take advantage of the |
I am not sure whether method We could perhaps expose |
@@ -280,8 +280,14 @@ public void setStatsFactory(StatsFactory statsFactory) { | |||
/** | |||
* @param metricsFactory the MetricsFactory to use on the Tracer to be built | |||
*/ | |||
public void withMetricsFactory(MetricsFactory metricsFactory) { | |||
public Configuration withMetricsFactory(MetricsFactory metricsFactory) { |
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 shouldn't break clients
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
d3e436e
to
17ea0a1
Compare
So are you recommending that you should first do |
Yes, the map is unmodifiable for a purpose, you can do |
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
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.
Apart from a small request, this LGTM
@@ -328,6 +333,14 @@ public void testNoServiceName() { | |||
new Configuration(null); | |||
} | |||
|
|||
@Test | |||
public void testOverrideServiceName() { |
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.
Can you add a test using withServiceName(null)
, and another with withServiceName("")
? This should document what is expected to happen in such case.
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.
It's not strictly related to this PR, but I am happy to add it.
Test for null service name is already there, I have added only for empty case.
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
@@ -328,6 +333,19 @@ public void testNoServiceName() { | |||
new Configuration(null); | |||
} | |||
|
|||
@Test(expected = RuntimeException.class) | |||
public void testEmptyServiceName() { | |||
new Configuration(""); |
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 actually thought about having the null
overriding a valid existing name:
new Configuration("Test").withServiceName(null);
This way, you'd be documenting the expected behavior for this scenario, as it might be ambiguous. This is not required, so, I'm giving my +1 to this PR.
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.
The check is also in tracer constructor, but in this case we wanted to fail before tracer-init time
Resolves #394
Configuration can be created programmatically o via env. If it is created via env all properties can be changed programmatically.
Signed-off-by: Pavol Loffay ploffay@redhat.com