sentry-clj
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:[email protected]/1")
(try
(do-something-risky)
(catch Exception e
(sentry/send-event {:throwable e})))
Supported event keys
:breadcrumbs
- a collection ofBreadcrumb
maps. See below.:checksum-for
- aString
whose checksum should be associated with the event.:checksum
- aString
which is the checksum for the event, if you're doing your own checksumming.:culprit
- aString
or aStackTraceElement
which identifies the so-called culprit. This is not very well documented at Sentry, but here is an example of how they use theString
variant in a Ruby application.:environment
- aString
which identifies the environment.:event-id
- aUUID
to identify the event. Autogenerated if not specified.:extra
- a map withKeyword
orString
keys (or anything for whichclojure.core/name
can be invoked) and values which can be JSON-ified. If:throwable
is given, this will automatically include itsex-data
.:fingerprint
- a sequence ofString
s that Sentry should use as a fingerprint.:interfaces
- a map withKeyword
orString
keys and values that can be JSON-ified. See the Sentry documentation on interfaces for information on the expected format.:level
- aKeyword
. 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
- aString
which identifies the logger.:message
- aString
. This is a different message than that of a Throwable.:platform
- aString
which identifies the platform.:release
- aString
which identifies the release.:server-name
- aString
which identifies the server name.:tags
- a map withKeyword
orString
keys (or anything for whichclojure.core/name
can be invoked) and values which can be coerced toStrings
withclojure.core/str
.:throwable
- aThrowable
object. Sentry's bread and butter.:timestamp
- something that can be coerced to aninst
using clj-time'sto-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
- AString
:timestamp
- something that can be coerced to aninst
using clj-time'sto-date
coercion:level
- aString
:message
- aString
:category
- aString
:data
- a map withString
keys andString
values
License
Copyright © 2016 Coda Hale, Sentry
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.