Package zipkin2.reporter.kafka
Class KafkaSender.Builder
- java.lang.Object
-
- zipkin2.reporter.kafka.KafkaSender.Builder
-
- Enclosing class:
- KafkaSender
public static final class KafkaSender.Builder extends Object
Configuration including defaults needed to send spans to a Kafka topic.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KafkaSender.BuilderbootstrapServers(String bootstrapServers)Initial set of kafka servers to connect to, rest of cluster will be discovered (comma separated).KafkaSenderbuild()KafkaSender.Builderencoding(Encoding encoding)Use this to change the encoding used in messages.KafkaSender.BuildermessageMaxBytes(int messageMaxBytes)Maximum size of a message.KafkaSender.Builderoverrides(Map<String,?> overrides)By default, a producer will be created, targeted tobootstrapServers(String)with 0 requiredacks.KafkaSender.Builderoverrides(Properties overrides)By default, a producer will be created, targeted tobootstrapServers(String)with 0 requiredacks.KafkaSender.Buildertopic(String topic)Topic zipkin spans will be send to.
-
-
-
Method Detail
-
topic
public KafkaSender.Builder topic(String topic)
Topic zipkin spans will be send to. Defaults to "zipkin"
-
bootstrapServers
public KafkaSender.Builder bootstrapServers(String bootstrapServers)
Initial set of kafka servers to connect to, rest of cluster will be discovered (comma separated). Ex "192.168.99.100:9092" No default- See Also:
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG
-
messageMaxBytes
public KafkaSender.Builder messageMaxBytes(int messageMaxBytes)
Maximum size of a message. Must be equal to or less than the server's "message.max.bytes" and "replica.fetch.max.bytes" to avoid rejected records on the broker side. Default 500KB.
-
overrides
public KafkaSender.Builder overrides(Map<String,?> overrides)
By default, a producer will be created, targeted tobootstrapServers(String)with 0 requiredacks. Any properties set here will affect the producer config.Consider not overriding batching properties ("batch.size" and "linger.ms") as those will duplicate buffering effort that is already handled by Sender.
For example: Reduce the timeout blocking from one minute to 5 seconds.
Map<String, String> overrides = new LinkedHashMap<>(); overrides.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, "5000"); builder.overrides(overrides);- See Also:
ProducerConfig
-
overrides
public KafkaSender.Builder overrides(Properties overrides)
By default, a producer will be created, targeted tobootstrapServers(String)with 0 requiredacks. Any properties set here will affect the producer config.Consider not overriding batching properties ("batch.size" and "linger.ms") as those will duplicate buffering effort that is already handled by Sender.
For example: Reduce the timeout blocking from one minute to 5 seconds.
Properties overrides = new Properties(); overrides.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, 5000); builder.overrides(overrides);- See Also:
ProducerConfig
-
encoding
public KafkaSender.Builder encoding(Encoding encoding)
Use this to change the encoding used in messages. Default is Encoding.JSONNote: If ultimately sending to Zipkin, version 2.8+ is required to process protobuf.
-
build
public KafkaSender build()
-
-