This publisher doesn't require java/clojure instrumentation libraries. It relies on existing μ/trace forms to capture and publish traces.
It uses the OpenTelemetry Protocol (OTLP) for wire communication over HTTP/JSON (not GRPC).
For a full list of supported vendors see: OpenTelemetry Ecosystem
It can publish to any OpenTelemetry compatible collector.
In order to use the library add the dependency to your project.clj
;; Leiningen project
[com.brunobonacci/mulog-opentelemetry "x.x.x"]
;; deps.edn format
{:deps { com.brunobonacci/mulog-opentelemetry {:mvn/version "x.x.x"}}}
The available configuration options:
{:type :open-telemetry
;; OpenTelemetry Collector endpoint for OTLP HTTP/JSON (REQUIRED)
:url "http://localhost:4318/"
;; 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 :open-telemetry
:url "http://localhost:4318/"})
Here is an example of how the traces look like:
NOTE: OpenTelemetry 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.