How to use opencensus standard tracing in clojure?

I am using this tracing library which follows the opencensus standard. Here is my code:

(def routes ["/" [["ping" {:get (constantly {:status 200
                                             :body   "pong"})}]
                  ["foo" {:post (->> foo-handler
                                      (trace/span "foo-file-handler"))}]
                  [true (constantly {:status 404})]]])

(m/defstate server
  :start (jetty/run-jetty (bd/make-handler routes) {:port  8080
                                                    :host  "localhost"
                                                    :join? false})
  :stop (.stop ^Server server))

(m/defstate tracer
  :start (jaegar/report "foo-service")
  :stop (jaegar/shutdown))

From the repl, I start the server and tracer states. I have jaegar-all-in-one docker running in my machine. I can see the jaegar dashboard in my browser too. But the traces don’t show up there when I call the API. I tried to narrow the problem down by just calling (trace/span "some-trace" (println "foo)) from the repl. Even this does not show up on the dashboard.

What am I missing here?

My bad, the traces are probabilistic as mentioned in the README of the library. I was using the default probability which less than 0.1 (I guess). I changed the probability to 1. Now the traces show up

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.