-
Notifications
You must be signed in to change notification settings - Fork 781
Description
Bug report
SleuthTagPropagationAutoConfiguration cannot auto-configured with yaml.
TagPropagationFinishedSpanHandler Bean is conditional on spring.sleuth.propagation.tag.whitelisted-keys
Lines 44 to 50 in 59216c3
| @Bean | |
| @ConditionalOnProperty("spring.sleuth.propagation.tag.whitelisted-keys") | |
| public FinishedSpanHandler finishedSpanHandler(SleuthProperties sleuthProperties, | |
| SleuthTagPropagationProperties tagPropagationProperties) { | |
| return new TagPropagationFinishedSpanHandler(sleuthProperties, | |
| tagPropagationProperties); | |
| } |
If you use properties file not yml, it works well. In TagPropagationFinishedSpanHandlerTest.java, it use properties. So it could be passed I think.
Lines 45 to 50 in 59216c3
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = { | |
| "spring.sleuth.baggage-keys=my-baggage", | |
| "spring.sleuth.propagation-keys=my-propagation,others-propagation", | |
| "spring.sleuth.propagation.tag.whitelisted-keys=my-baggage,my-propagation" }, | |
| classes = TagPropagationFinishedSpanHandlerTest.TestConfiguration.class) | |
| public class TagPropagationFinishedSpanHandlerTest { |
But if you use yml file, Condition cannot be matched with yml list syntax.
spring.sleuth.propagation.tag.whitelisted-keys: [foo, bar]
spring.sleuth.propagation.tag.whitelisted-keys:
- foo
- barAll above two cases doesn't work.
ConditionalOnProperty annotation cannot be used with Collections. Please check below javadoc link.
https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.html
I think it have to apply custom Conditional annotation for colleciton. Or just make bean when spring.sleuth.propagation.tag.enabled is true.
FYI, If you want to use TagPropagationFinishedSpanHandler with yml file, Only spring.sleuth.propagation.tag.whitelisted-keys: foo,bar works.