spring-cloud / spring-cloud-sleuth

Distributed tracing for spring cloud
https://spring.io/projects/spring-cloud-sleuth
Apache License 2.0
1.77k stars 782 forks source link

default sender is Kafka when it is detected on the classpath #985

Closed jorgheymans closed 6 years ago

jorgheymans commented 6 years ago

Enhancement

It seems that as soon as Kafka is on the classpath, spring.zipkin.sender.type is set to KAFKA. However unless kafka is nicely configured upfront, users will see their logs flooded with below stacktraces. This is not a nice out of the box experience and will send users on a stack overflow witch hunt. A much safer choice IMO would be to set WEB as the default, that one needs very few config options to work (just the zipkin base URL i think), and make users explicitly set sender.type when kafka is required.

2018-05-22 10:29:19.788 ERROR [localdev,,,] 14540 --- [ad | producer-1] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-1] Uncaught error in kafka producer I/O thread: 

org.apache.kafka.common.protocol.types.SchemaException: Error reading field 'correlation_id': java.nio.BufferUnderflowException
    at org.apache.kafka.common.protocol.types.Schema.read(Schema.java:76) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.common.requests.ResponseHeader.parse(ResponseHeader.java:61) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.NetworkClient.parseStructMaybeUpdateThrottleTimeMetrics(NetworkClient.java:584) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.NetworkClient.handleCompletedReceives(NetworkClient.java:686) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:469) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:239) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:163) ~[kafka-clients-1.0.1.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]

2018-05-22 10:29:19.789 ERROR [localdev,,,] 14540 --- [ad | producer-1] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-1] Uncaught error in kafka producer I/O thread: 

java.lang.IllegalStateException: There are no in-flight requests for node -1
    at org.apache.kafka.clients.InFlightRequests.requestQueue(InFlightRequests.java:58) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.InFlightRequests.completeNext(InFlightRequests.java:66) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.NetworkClient.handleCompletedReceives(NetworkClient.java:685) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:469) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:239) ~[kafka-clients-1.0.1.jar:na]
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:163) ~[kafka-clients-1.0.1.jar:na]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]
marcingrzejszczak commented 6 years ago

@jorgheymans can you check that it's working fine with the latest snapshots?

jorgheymans commented 6 years ago

@marcingrzejszczak what is the reason for needing both spring.zipkin.kafka.enabled=true and spring.zipkin.sender.type=kafka to enable kafka ? I'm sure there is a good reason, but from a user point of view it seems strange. I will have a look at the snapshots tomorrow.

marcingrzejszczak commented 6 years ago

Ah! Good point. If someone sets the type explicitly that should be enough