A Sentry SDK for Racket
(require sentry) | package: sentry-lib |
1 Introduction
This library provides an interface for capturing and sending errors to either a managed or a self-hosted Sentry instance.
2 API Stability
This package is pre-1.0 and its API may change without notice!
3 Quickstart
Install the package from the package server with
$ raco pkg install sentry |
Call make-sentry to create an instance of the sentry client. Keep a reference to the client around for as long as your application needs to run and you can start sending exceptions by calling sentry-capture-exception!:
(require sentry) (parameterize ([current-sentry (make-sentry "https://key@sentry.io/12")]) (sentry-capture-exception! (make-exn:fail "an error" (current-continuation-marks))))
4 Reference
4.1 Core API
parameter
(current-sentry client) → void? client : sentry?
procedure
(make-sentry dsn [ #:backlog backlog #:release release #:environment environment]) → sentry? dsn : string? backlog : exact-positive-integer? = 128
release : (or/c false/c non-empty-string?) = (getenv "SENTRY_RELEASE")
environment : (or/c false/c non-empty-string?) = (getenv "SENTRY_ENVIRONMENT")
backlog specifies the size of the error queue. When the queue fills up, calls to sentry-capture-exception! will start to block so you need to size this appropriately.
release can be set to tag each error with the current release (usually a GIT SHA).
environment can be set to tag each error with the current environment (eg. "production" or "staging").
Sentry clients log messages to the 'sentry topic.
procedure
(sentry-capture-exception! e [ client #:level level #:timestamp timestamp #:server-name server-name #:environment environment #:release release #:request request #:tags tags #:user user]) → void? e : exn? client : (or/c false/c sentry?) = (current-sentry) level : (or/c 'fatal 'error 'warning 'info 'debug) = 'error timestamp : moment? = (now/moment) server-name : (or/c false/c non-empty-string?) = #f environment : (or/c false/c non-empty-string?) = #f release : (or/c false/c non-empty-string?) = #f request : (or/c false/c request?) = #f tags : (hash/c non-empty-string? string?) = (hash) user : sentry-user? = (current-sentry-user)
Does nothing when client is #f.
4.2 Users
procedure
(sentry-user? v) → boolean?
v : any/c
parameter
(current-sentry-user user) → void? user : (or/c false/c sentry-user?)
sentry-capture-exception! automatically picks these values up unless a different value is specified via its #:user argument.
procedure
(make-sentry-user #:id id [ #:username username #:email email #:ip-address ip-address #:subscription subscription]) → sentry-user? id : non-empty-string? username : (or/c false/c non-empty-string?) = #f email : (or/c false/c non-empty-string?) = #f ip-address : (or/c false/c non-empty-string?) = #f subscription : (or/c false/c non-empty-string?) = #f
Index
|
A Sentry SDK for Racket |