Class WebClientSender

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class WebClientSender
    extends zipkin2.reporter.Sender
    Sender that uses WebClient to send spans to Zipkin.
    Since:
    3.1.0
    • Constructor Detail

      • WebClientSender

        public WebClientSender​(org.springframework.web.reactive.function.client.WebClient webClient,
                               String baseUrl,
                               String apiPath,
                               zipkin2.codec.BytesEncoder<zipkin2.Span> encoder,
                               long checkTimeout)
        Creates a new instance of WebClientSender.
        Parameters:
        webClient - web client
        baseUrl - base url
        apiPath - api path
        encoder - encoder
        checkTimeout - check timeout
      • WebClientSender

        public WebClientSender​(Function<reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Void>>,​reactor.core.publisher.Mono<org.springframework.http.ResponseEntity<Void>>> wrapperFunction,
                               org.springframework.web.reactive.function.client.WebClient webClient,
                               String baseUrl,
                               String apiPath,
                               zipkin2.codec.BytesEncoder<zipkin2.Span> encoder,
                               long checkTimeout)
        Creates a new instance of WebClientSender.
        Parameters:
        webClient - web client
        wrapperFunction - function that will be run on onErrorResume. Send in null to get default behavior.
        baseUrl - base url
        apiPath - api path
        encoder - encoder
        checkTimeout - check timeout
    • Method Detail

      • encoding

        public zipkin2.codec.Encoding encoding()
        Specified by:
        encoding in class zipkin2.reporter.Sender
      • messageMaxBytes

        public int messageMaxBytes()
        Specified by:
        messageMaxBytes in class zipkin2.reporter.Sender
      • messageSizeInBytes

        public int messageSizeInBytes​(List<byte[]> spans)
        Specified by:
        messageSizeInBytes in class zipkin2.reporter.Sender
      • sendSpans

        public zipkin2.Call<Void> sendSpans​(List<byte[]> encodedSpans)
        Specified by:
        sendSpans in class zipkin2.reporter.Sender
      • check

        public zipkin2.CheckResult check()
        Sends an empty json message to the configured endpoint.
        Overrides:
        check in class zipkin2.Component
      • close

        public void close()
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Overrides:
        close in class zipkin2.Component