In order to use the library add the dependency to your project.clj
;; Leiningen project
[com.brunobonacci/mulog-zipkin "x.x.x"]
;; deps.edn format
{:deps { com.brunobonacci/mulog-zipkin {:mvn/version "x.x.x"}}}
The events must be serializeable in JSON format (see How to JSON encode custom Java classes for more info.)
The available configuration options:
{:type :zipkin
;; Zipkin endpoint (REQUIRED)
:url "http://localhost:9411/"
;; the maximum number of events which can be sent in a single
;; batch request to Zipkin
:max-items 5000
;; Interval in milliseconds between publish requests.
;; μ/log will try to send the records to Zipkin
;; with the interval specified.
:publish-delay 5000
;; a function to apply to the sequence of events before publishing.
;; This transformation function can be used to filter, tranform,
;; anonymise events before they are published to a external system.
;; by defatult there is no transformation. (since v0.1.8)
:transform identity
;; extra http options to pass to the HTTP client
:http-opts {}
}
How to use it:
(μ/start-publisher!
{:type :zipkin
:url "http://localhost:9411/"})
Here is an example of how the traces look like:
NOTE: Zipkin requires an application name for the traces, use
set-global-context
to define one, like:
;; set global context
(μ/set-global-context!
{:app-name "my-app", :version "0.1.0", :env "local"})
see example here.