-
Notifications
You must be signed in to change notification settings - Fork 784
Added support for multiple reporters #1181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for multiple reporters #1181
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1181 +/- ##
============================================
+ Coverage 69.82% 69.97% +0.14%
- Complexity 773 775 +2
============================================
Files 142 142
Lines 3526 3530 +4
Branches 387 388 +1
============================================
+ Hits 2462 2470 +8
+ Misses 841 836 -5
- Partials 223 224 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #1181 +/- ##
===========================================
+ Coverage 69.78% 69.8% +0.02%
- Complexity 772 773 +1
===========================================
Files 142 142
Lines 3518 3521 +3
Branches 384 385 +1
===========================================
+ Hits 2455 2458 +3
Misses 841 841
Partials 222 222
Continue to review full report at Codecov.
|
| * also replace with a standard one. | ||
| */ | ||
| @Bean | ||
| @Bean("zipkinReporter") |
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.
maybe extract to some constant?
| private String topic; | ||
|
|
||
| @Bean | ||
| @Bean("zipkinSender") |
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.
maybe extract to some constant?
| private String queue; | ||
|
|
||
| @Bean | ||
| @Bean("zipkinSender") |
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.
maybe extract to some constant?
| } | ||
|
|
||
| @Test | ||
| public void supportsMultipleReporters() { |
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 report a span and verify that both senders and reporters were actually called?
|
I'm worried that this will result in a hidden mis-configuration. I think this feature should require a flag IE: Maybe I bring in 2 different starters that have Reporters in them and neither of them with |
| @ConditionalOnMissingBean | ||
| public Reporter<Span> reporter(ReporterMetrics reporterMetrics, | ||
| ZipkinProperties zipkin, Sender sender, BytesEncoder<Span> spanBytesEncoder) { | ||
| ZipkinProperties zipkin, @Qualifier(SENDER_BEAN_NAME) Sender sender, |
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 this needs a doc update associated with it since now overriding requires the correct bean name for a Sender
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 whole change needs a doc update because the overall configuration has been updated to support multiple tracers.
I already made the change for spring-cloud-gcp-trace (spring-attic/spring-cloud-gcp#1383).
Maybe I don't get it yet, but if neither is
I'm for making this opt in - that makes sense. |
Honestly I do not agree, this shouldn't be configured with a property. |
Fair enough, makes sense. So let's make it opt out :) |
…ation` so other implementations can use the same default
opt-out can be done using eg. |
|
Pinging @adriancole to have a second pair of eyes. |
|
I found out there is a breaking change, I'll make some adaptations accordingly. |
…another tracing system extends from spring-cloud-sleuth-zipkin (like spring-cloud-gcp-trace)
|
That's weird... It's the second time that |
|
|
||
| private Reporter<zipkin2.Span> adjustedReporter(Reporter<zipkin2.Span> delegate) { | ||
| private Reporter<zipkin2.Span> compositeReporter() { | ||
| return (span) -> { |
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.
optional: I would pull this into a static or package private class as it isn't debug friendly. a toString would be nice, and it would also be nice to not have to loop for the common case where there is only one reporter. Another optional would be to catch exceptions in the loop such that one report failure doesn't fail others.
|
I approved not as an overruling thing but based on my understanding of things. Those using sleuth should have a stronger opinion |
Targets issue #1180.