Skip to content
A thin wrapper around the official Java library for Sentry.
Branch: master
Clone or download
Latest commit 64e3cc8 Jun 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev Initial commit. Sep 6, 2016
src/sentry_clj Fix Event/EventBuilder type hint, getId. Apr 25, 2018
test/sentry_clj Capture EventBuilder instead of Event. Apr 23, 2018
.gitignore
.travis.yml
LICENSE Initial commit. Sep 6, 2016
README.md Cleanup naming, using atom, synchonize initialization code. Jun 30, 2017
project.clj Bump to 0.7.2 Jun 14, 2018

README.md

sentry-clj

Clojars Project

A thin wrapper around the official Java library for Sentry.

Usage

(require '[sentry-clj.core :as sentry])

; you can initialize Sentry manually by providing a DSN in the code (as shown below),
; or use one of the other configuration options (such as environment variables) described
; in the Java SDK documentation (which will automatically initialize Sentry the first
; time you attempt to send an event): https://docs.sentry.io/clients/java/config/
(sentry/init! "https://public:private@sentry.io/1")

(try
  (do-something-risky)
  (catch Exception e
    (sentry/send-event {:throwable e})))

Supported event keys

  • :breadcrumbs - a collection of Breadcrumb maps. See below.
  • :checksum-for - a String whose checksum should be associated with the event.
  • :checksum - a String which is the checksum for the event, if you're doing your own checksumming.
  • :culprit - a String or a StackTraceElement which identifies the so-called culprit. This is not very well documented at Sentry, but here is an example of how they use the String variant in a Ruby application.
  • :environment - a String which identifies the environment.
  • :event-id - a UUID to identify the event. Autogenerated if not specified.
  • :extra - a map with Keyword or String keys (or anything for which clojure.core/name can be invoked) and values which can be JSON-ified. If :throwable is given, this will automatically include its ex-data.
  • :fingerprint - a sequence of Strings that Sentry should use as a fingerprint.
  • :interfaces - a map with Keyword or String keys and values that can be JSON-ified. See the Sentry documentation on interfaces for information on the expected format.
  • :level - a Keyword. One of :debug, :info, :warning, :error, :fatal. Probably most useful in conjunction with :message if you need to report an exceptional condition that's not an exception.
  • :logger - a String which identifies the logger.
  • :message - a String. This is a different message than that of a Throwable.
  • :platform - a String which identifies the platform.
  • :release - a String which identifies the release.
  • :server-name - a String which identifies the server name.
  • :tags - a map with Keyword or String keys (or anything for which clojure.core/name can be invoked) and values which can be coerced to Strings with clojure.core/str.
  • :throwable - a Throwable object. Sentry's bread and butter.
  • :timestamp - something that can be coerced to an inst using clj-time's to-date coercion

Breadcrumbs

Read more about breadcrumbs at docs.sentry.io/learn/breadcrumbs/.

When an event has a :breadcrumbs key, each element of the value collection should be a map. Supported keys of the map are:

  • :type - A String
  • :timestamp - something that can be coerced to an inst using clj-time's to-date coercion
  • :level - a String
  • :message - a String
  • :category - a String
  • :data - a map with String keys and String values

License

Copyright © 2016 Coda Hale, Sentry

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

You can’t perform that action at this time.