Liking cljdoc? Tell your friends :D

sentry-clj.core

A thin wrapper around the official Java library for Sentry.

A thin wrapper around the official Java library for Sentry.
raw docstring

close!clj

(close!)

Closes the SDK

Closes the SDK
sourceraw docstring

flush-eventsclj

(flush-events timeout-millis)

Flushes events to Sentry, blocking until the flush is complete.

You can pass a timeout in milliseconds to wait for the flush to complete.

Flushes events to Sentry, blocking until the flush is complete.

You can pass a timeout in milliseconds to wait for the flush to complete.
sourceraw docstring

init!clj

(init! dsn)
(init! dsn {:keys [contexts] :as config})

Initialize Sentry with the mandatory dsn

Other options include:

keydescriptiondefault
:enable-external-configurationEnable loading configuration from the properties file, system properties or environment variables
:environmentSet the environment on which Sentry events will be logged, e.g., "production"production
:enabledEnable or disable sentry.true
:debugEnable SDK logging at the debug levelfalse
:loggerInstance of io.sentry.ILogger (only applies when :debug is on)io.sentry.SystemOutLogger
:diagnostic-levelLog messages at or above this level (only applies when :debug is on):debug
:releaseAll events are assigned to a particular release
:distSet the application distribution that will be sent with each event
:server-nameSet the server name that will be sent with each event
:shutdown-timeout-millisWait up to X milliseconds before shutdown if there are events to send2000ms
:in-app-includesA seqable collection (vector for example) containing package names to include when sending events
:in-app-excludesA seqable collection (vector for example) containing package names to ignore when sending events
`:ignored-exceptions-for-typeSet exceptions that will be filtered out before sending to Sentry (a set of Classnames as Strings)
:enable-uncaught-exception-handlerEnables the uncaught exception handlertrue
:before-send-fnA function (taking an event and a hint)
The body of the function must not be lazy (i.e., don't use filter on its own!) and must return an event or nil
If a nil is returned, the event will not be sent to Sentry
More Information
:before-breadcrumb-fnA function (taking a breadcrumb and a hint)
The body of the function must not be lazy (i.e., don't use filter on its own!) and must return a breadcrumb or nil
If a nil is returned, the breadcrumb will not be sent to Sentry
More Information
:contextsA map of key/value pairs to attach to every Event that is sent.
[More Information)(https://docs.sentry.io/platforms/java/enriching-events/context/)
:traces-sample-rateSet a uniform sample rate(a number of between 0.0 and 1.0) for all transactions for tracing
:traces-sample-fnA function (taking a custom sample context and a transaction context) enables you to control trace transactions
:serialization-max-depthSet to a lower number, i.e., 2, if you experience circular reference errors when sending events5
:trace-options-requestSet to enable or disable tracing of options requeststrue

Some examples:

(init! "http://abcdefg@localhost:19000/2")
(init! "http://abcdefg@localhost:19000/2" {:environment "production" :debug true :release "foo.bar@1.0.0" :in-app-excludes ["foo.bar"])
(init! "http://abcdefg@localhost:19000/2" {:before-send-fn (fn [event _] (when-not (= (.. event getMessage getMessage "foo")) event))})
(init! "http://abcdefg@localhost:19000/2" {:before-send-fn (fn [event _] (.setServerName event "fred") event)})
(init! "http://abcdefg@localhost:19000/2" {:contexts {:foo "bar" :baz "wibble"}})
Initialize Sentry with the mandatory `dsn`

Other options include:

| key                                  | description                                                                                                        | default
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -------
| `:enable-external-configuration`     | Enable loading configuration from the properties file, system properties or environment variables                  |
| `:environment`                       | Set the environment on which Sentry events will be logged, e.g., "production"                                    | production
| `:enabled`                           | Enable or disable sentry.                                                                                          | true
| `:debug`                             | Enable SDK logging at the debug level                                                                              | false
| `:logger`                            | Instance of `io.sentry.ILogger` (only applies when `:debug` is on)                                                 | `io.sentry.SystemOutLogger`
| `:diagnostic-level`                  | Log messages at or above this level (only applies when `:debug` is on)                                             | `:debug`
| `:release`                           | All events are assigned to a particular release                                                                    |
| `:dist`                              | Set the application distribution that will be sent with each event                                                 |
| `:server-name`                       | Set the server name that will be sent with each event                                                              |
| `:shutdown-timeout-millis`           | Wait up to X milliseconds before shutdown if there are events to send                                              | 2000ms
| `:in-app-includes`                   | A seqable collection (vector for example) containing package names to include when sending events                  |
| `:in-app-excludes`                   | A seqable collection (vector for example) containing package names to ignore when sending events                   |
| `:ignored-exceptions-for-type        | Set exceptions that will be filtered out before sending to Sentry (a set of Classnames as Strings)                 |
| `:enable-uncaught-exception-handler` | Enables the uncaught exception handler                                                                             | true
| `:before-send-fn`                    | A function (taking an event and a hint)                                                                            |
|                                      | The body of the function must not be lazy (i.e., don't use filter on its own!) and must return an event or nil     |
|                                      | If a nil is returned, the event will not be sent to Sentry                                                         |
|                                      | [More Information](https://docs.sentry.io/platforms/java/data-management/sensitive-data/)                          |
| `:before-breadcrumb-fn`              | A function (taking a breadcrumb and a hint)                                                                        |
|                                      | The body of the function must not be lazy (i.e., don't use filter on its own!) and must return a breadcrumb or nil |
|                                      | If a nil is returned, the breadcrumb will not be sent to Sentry                                                    |
|                                      | [More Information](https://docs.sentry.io/platforms/java/enriching-events/breadcrumbs/)                            |
| `:contexts`                          | A map of key/value pairs to attach to every Event that is sent.                                                    |
|                                      | [More Information)(https://docs.sentry.io/platforms/java/enriching-events/context/)                                |
| `:traces-sample-rate`                | Set a uniform sample rate(a number of between 0.0 and 1.0) for all transactions for tracing                        |
| `:traces-sample-fn`                  | A function (taking a custom sample context and a transaction context) enables you to control trace transactions    |
| `:serialization-max-depth`           | Set to a lower number, i.e., 2, if you experience circular reference errors when sending events                    | 5
| `:trace-options-request`             | Set to enable or disable tracing of options requests                                                               | true

Some examples:

```clojure
(init! "http://abcdefg@localhost:19000/2")
```

```clojure
(init! "http://abcdefg@localhost:19000/2" {:environment "production" :debug true :release "foo.bar@1.0.0" :in-app-excludes ["foo.bar"])
```

```clojure
(init! "http://abcdefg@localhost:19000/2" {:before-send-fn (fn [event _] (when-not (= (.. event getMessage getMessage "foo")) event))})
```

```clojure
(init! "http://abcdefg@localhost:19000/2" {:before-send-fn (fn [event _] (.setServerName event "fred") event)})
```

```clojure
(init! "http://abcdefg@localhost:19000/2" {:contexts {:foo "bar" :baz "wibble"}})
```
sourceraw docstring

java-util-hashmappify-valsclj

(java-util-hashmappify-vals m)

Converts an ordinary Clojure map into a java.util.HashMap object. This is done recursively for all nested maps as well. Keywords in any nested values are converted to strings. Based on walk/stringify-keys.

Converts an ordinary Clojure map into a java.util.HashMap object.
This is done recursively for all nested maps as well.
Keywords in any nested values are converted to strings.
Based on walk/stringify-keys.
sourceraw docstring

send-eventclj

(send-event event)

Sends the given event to Sentry, returning the event's id

Supports sending throwables:

(sentry/send-event {:message   "oh no",
:throwable (RuntimeException. "foo bar"})
Sends the given event to Sentry, returning the event's id

Supports sending throwables:

```
(sentry/send-event {:message   "oh no",
:throwable (RuntimeException. "foo bar"})
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close