Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traces-sample-fn not being called #50

Open
piero opened this issue Oct 18, 2022 · 0 comments
Open

traces-sample-fn not being called #50

piero opened this issue Oct 18, 2022 · 0 comments

Comments

@piero
Copy link

piero commented Oct 18, 2022

Environment

  • Clojure 1.11.1
  • sentry-clj 6.4.185

Steps to Reproduce

(defn traces-sampler
  [{:keys [custom-sample-context transaction-context]}]
  (println "-> custom-sample-context:" custom-sample-context)
  (println "-> transaction-context:" transaction-context)
  0.1)

(sentry/init! config/sentry-endpoint
              {:server-name              config/application-name
               :environment              config/environment
               :traces-sample-fn         traces-sampler
               :uncaught-handler-enabled true
               :before-send-fn           (fn [^SentryEvent event ^Hint _hint]
                                           (println (format "[%s] Reporting to Sentry: %s"
                                                            (str (.getLevel event))
                                                            (.getMessage (.getMessage event))))
                                           event)})

(sentry/send-event
      {:message     "This is a test"
       :server-name config/application-name
       :level       :error
       :throwable   (Exception. "Boom!")})

Expected Result

I should see the output of

  (println "-> custom-sample-context:" custom-sample-context)
  (println "-> transaction-context:" transaction-context)

Actual Result

I don't see that output. It looks like the traces-sampler function is not being called.
Am I defining the traces-sampler function correctly? Couldn't find any examples for it, so just guessed from the source code. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant