Kafka sender needs to be explicitly set
default sender is Kafka when it is detected on the classpath, with this change it will be Web. You have to set `spring.zipkin.kafka.enabled` to `true` to use Kafka fixes gh-985
This commit is contained in:
@@ -887,6 +887,9 @@ The following example shows setting the sender type for `web`:
|
||||
spring.zipkin.sender.type: web
|
||||
----
|
||||
|
||||
IMPORTANT: If you have Kafka on the classpath, you need to set
|
||||
`spring.zipkin.kafka.enabled` to `true` apart from setting the sender type.
|
||||
|
||||
To customize the `RestTemplate` that sends spans to Zipkin via HTTP, you can register
|
||||
the `ZipkinRestTemplateCustomizer` bean.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
@@ -35,6 +36,7 @@ import zipkin2.reporter.kafka11.KafkaSender;
|
||||
@ConditionalOnBean(KafkaProperties.class)
|
||||
@ConditionalOnMissingBean(Sender.class)
|
||||
@Conditional(ZipkinSenderCondition.class)
|
||||
@ConditionalOnProperty(value = "spring.zipkin.kafka.enabled", havingValue = "true")
|
||||
class ZipkinKafkaSenderConfiguration {
|
||||
@Value("${spring.zipkin.kafka.topic:zipkin}")
|
||||
private String topic;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{"properties": [
|
||||
{
|
||||
"name": "spring.zipkin.kafka.enabled",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "Should Kafka Zipkin sender be enabled. With Kafka on the classpath you have to set this value to true to send spans to Zipkin via Kafka.",
|
||||
"defaultValue": false
|
||||
}
|
||||
]}
|
||||
@@ -124,7 +124,8 @@ public class ZipkinAutoConfigurationTests {
|
||||
@Test
|
||||
public void overrideKafkaTopic() throws Exception {
|
||||
context = new AnnotationConfigApplicationContext();
|
||||
addEnvironment(context, "spring.zipkin.kafka.topic:zipkin2");
|
||||
addEnvironment(context, "spring.zipkin.kafka.topic:zipkin2",
|
||||
"spring.zipkin.kafka.enabled:true");
|
||||
context.register(
|
||||
PropertyPlaceholderAutoConfiguration.class,
|
||||
KafkaAutoConfiguration.class,
|
||||
|
||||
Reference in New Issue
Block a user