The sentry-client Reference Manual

This is the sentry-client Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sat Dec 03 20:39:53 2022 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 sentry-client

Sentry client

Author

Mariano Montone <>

Home Page

https://github.com/mmontone/cl-sentry-client

License

MIT

Long Description

# CL-SENTRY-CLIENT

Sentry client for Common Lisp

WIP

## Basic usage

“‘lisp
(sentry-client:initialize-sentry-client <sentry-dsn>)
(sentry-client:with-sentry-error-handler () (error "test"))
“‘

Or in your own error handler:

“‘lisp
(handler-case (my-code-with-error)
(error (e)
(sentry-client:capture-exception e)
...)))
“‘

### Hunchentoot handler

“‘lisp
(defmethod hunchentoot:maybe-invoke-debugger :after (condition)
(when hunchentoot:*catch-errors-p*
;; There’s an error in trivial-backtrace:map-backtrace in SBCL
;; if we don’t set sb-debug:*stack-top-hint* to NIL
(let ((sb-debug:*stack-top-hint* nil))
(sentry-client:capture-exception condition))))
“‘

Just add ‘sentry-client.hunchentoot‘ as ASDF dependency to include the Hunchentoot handler.

## Async client version

The async version of the client uses simple-tasks library for sending HTTP requests in the background

“‘lisp
(ql:quickload :sentry-client.async)

(sentry-client:initialize-sentry-client <dsn> :client-class ’sentry-client:async-sentry-client) (sentry-client:test-sentry-client)
“‘

## Screenshots

![alt text](https://github.com/mmontone/cl-sentry-client/raw/master/doc/screenshot1.png "Screenshot 1") ![alt text](https://github.com/mmontone/cl-sentry-client/raw/master/doc/screenshot2.png "Screenshot 2")

## License

MIT

Version

0.0.1

Dependencies
  • drakma (system).
  • cl-json (system).
  • cl-ppcre (system).
  • uuid (system).
  • local-time (system).
  • trivial-backtrace (system).
Source

sentry-client.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 sentry-client/sentry-client.asd

Source

sentry-client.asd.

Parent Component

sentry-client (system).

ASDF Systems

sentry-client.


3.1.2 sentry-client/package.lisp

Source

sentry-client.asd.

Parent Component

sentry-client (system).

Packages

sentry-client.


3.1.3 sentry-client/sentry-client.lisp

Dependency

package.lisp (file).

Source

sentry-client.asd.

Parent Component

sentry-client (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 sentry-client

# CL-SENTRY-CLIENT

Sentry client for Common Lisp

WIP

## Basic usage

“‘lisp
(sentry-client:initialize-sentry-client <sentry-dsn>)
(sentry-client:with-sentry-error-handler () (error "test"))
“‘

Or in your own error handler:

“‘lisp
(handler-case (my-code-with-error)
(error (e)
(sentry-client:capture-exception e)
...)))
“‘

### Hunchentoot handler

“‘lisp
(defmethod hunchentoot:maybe-invoke-debugger :after (condition)
(when hunchentoot:*catch-errors-p*
;; There’s an error in trivial-backtrace:map-backtrace in SBCL
;; if we don’t set sb-debug:*stack-top-hint* to NIL
(let ((sb-debug:*stack-top-hint* nil))
(sentry-client:capture-exception condition))))
“‘

Just add ‘sentry-client.hunchentoot‘ as ASDF dependency to include the Hunchentoot handler.

## Async client version

The async version of the client uses simple-tasks library for sending HTTP requests in the background

“‘lisp
(ql:quickload :sentry-client.async)

(sentry-client:initialize-sentry-client <dsn> :client-class ’sentry-client:async-sentry-client) (sentry-client:test-sentry-client)
“‘

## Screenshots

![alt text](https://github.com/mmontone/cl-sentry-client/raw/master/doc/screenshot1.png "Screenshot 1") ![alt text](https://github.com/mmontone/cl-sentry-client/raw/master/doc/screenshot2.png "Screenshot 2")

## License

MIT

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *sentry-client*

The current sentry client.

Package

sentry-client.

Source

sentry-client.lisp.


5.1.2 Macros

Macro: with-sentry-error-handler ((&key resignal) &body body)

Setup an error handler that sends conditions signaled in BODY to Sentry.
If RESIGNAL is T (default), then the condition is resignaled after being captured by the Sentry handler.

Package

sentry-client.

Source

sentry-client.lisp.


5.1.3 Ordinary functions

Function: capture-exception (condition &rest args)

Send CONDITION to Sentry.

Package

sentry-client.

Source

sentry-client.lisp.

Function: initialize-sentry-client (dsn &rest args &key client-class)
Package

sentry-client.

Source

sentry-client.lisp.

Function: test-sentry-client (datum &rest args)

Use for testing the sentry client.

Use: (test-sentry-client ’error "my error")

Package

sentry-client.

Source

sentry-client.lisp.


5.1.4 Generic functions

Generic Function: sentry-tags (error)

Returns an alist of tags for ERROR.
User can specialize this generic function for custom CONDITION classes.

Package

sentry-client.

Source

sentry-client.lisp.

Methods
Method: sentry-tags ((condition condition))

5.1.5 Standalone methods

Method: initialize-instance :after ((sentry-client sentry-client) &rest initargs)
Source

sentry-client.lisp.


5.1.6 Classes

Class: sentry-client

A sentry client

Package

sentry-client.

Source

sentry-client.lisp.

Direct methods
Direct slots
Slot: dsn
Initform

(error "provide the dsn")

Initargs

:dsn

Readers

dsn.

Writers

(setf dsn).

Slot: transport
Initform

:http

Initargs

:transport

Readers

sentry-transport.

Writers

(setf sentry-transport).

Slot: connection-timeout
Initform

10

Initargs

:connection-timeout

Readers

connection-timeout.

Writers

(setf connection-timeout).


5.2 Internals


5.2.1 Special variables

Special Variable: +dsn-regex+
Package

sentry-client.

Source

sentry-client.lisp.

Special Variable: +sentry-timestamp-format+
Package

sentry-client.

Source

sentry-client.lisp.


5.2.2 Macros

Macro: with-sentry-client ((class &rest args) &body body)

Run BODY in the scope of a sentry client created from CLASS and ARGS.

Package

sentry-client.

Source

sentry-client.lisp.


5.2.3 Ordinary functions

Function: call-with-sentry-client (function client-class &rest args)

Call FUNCTION in the context of a SENTRY-CLIENT instantied from CLIENT-CLASS and ARGS.

Package

sentry-client.

Source

sentry-client.lisp.

Function: encode-core-event-attributes (condition json-stream &key extras sentry-client transaction)

Encode core Sentry event attributes.

See: https://develop.sentry.dev/sdk/event-payloads/

Package

sentry-client.

Source

sentry-client.lisp.

Function: encode-exception (condition json-stream &optional sentry-client)

Encode CONDITION into JSON-STREAM.

Package

sentry-client.

Source

sentry-client.lisp.

Function: encode-exception-event (condition &key sentry-client extras transaction)

Encode CONDITION to a string in JSON format for Sentry.

Package

sentry-client.

Source

sentry-client.lisp.

Function: encode-sentry-auth-header (sentry-client)

Encode Sentry authentication header.

Package

sentry-client.

Source

sentry-client.lisp.

Function: encode-stacktrace (condition json-stream &optional sentry-client)

Encode stacktrace for CONDITION as JSON in JSON-STREAM.

Package

sentry-client.

Source

sentry-client.lisp.

Function: format-sentry-timestamp (stream &optional timestamp)

Format TIMESTAMP for Sentry.
If no TIMESTAMP is provided, then current time is used.

Package

sentry-client.

Source

sentry-client.lisp.

Function: make-sentry-client (dsn &optional class)
Package

sentry-client.

Source

sentry-client.lisp.

Function: make-sentry-event-id ()

Create an ID for a new Sentry event.

Package

sentry-client.

Source

sentry-client.lisp.

Function: parse-dsn (dsn-string)

Parse a DSN string to a list object.
See: https://docs.sentry.io/product/sentry-basics/dsn-explainer/

Package

sentry-client.

Source

sentry-client.lisp.

Function: post-sentry-request (data &optional sentry-client)

Just send DATA to sentry api via HTTP.

Package

sentry-client.

Source

sentry-client.lisp.

Function: read-dsn (dsn)

Return a DSN object. If DSN is an object already, it returns it. If it is a string, it parses it.

Package

sentry-client.

Source

sentry-client.lisp.

Function: sentry-api-url (&optional sentry-client)

The events url.

See: https://develop.sentry.dev/sdk/store/

Package

sentry-client.

Source

sentry-client.lisp.


5.2.4 Generic functions

Generic Function: client-capture-exception (sentry-client condition &key extras transaction)
Package

sentry-client.

Methods
Method: client-capture-exception ((sentry-client sentry-client) condition &key extras transaction)

Send CONDITION to Sentry.

Source

sentry-client.lisp.

Generic Function: condition-severity-level (condition)

The condition severity level (warning, error, etc)

Package

sentry-client.

Source

sentry-client.lisp.

Methods
Method: condition-severity-level ((condition error))
Method: condition-severity-level ((condition warning))
Method: condition-severity-level ((condition condition))
Generic Reader: connection-timeout (object)
Package

sentry-client.

Methods
Reader Method: connection-timeout ((sentry-client sentry-client))

automatically generated reader method

Source

sentry-client.lisp.

Target Slot

connection-timeout.

Generic Writer: (setf connection-timeout) (object)
Package

sentry-client.

Methods
Writer Method: (setf connection-timeout) ((sentry-client sentry-client))

automatically generated writer method

Source

sentry-client.lisp.

Target Slot

connection-timeout.

Generic Reader: dsn (object)
Package

sentry-client.

Methods
Reader Method: dsn ((sentry-client sentry-client))

automatically generated reader method

Source

sentry-client.lisp.

Target Slot

dsn.

Generic Writer: (setf dsn) (object)
Package

sentry-client.

Methods
Writer Method: (setf dsn) ((sentry-client sentry-client))

automatically generated writer method

Source

sentry-client.lisp.

Target Slot

dsn.

Generic Reader: sentry-transport (object)
Package

sentry-client.

Methods
Reader Method: sentry-transport ((sentry-client sentry-client))

automatically generated reader method

Source

sentry-client.lisp.

Target Slot

transport.

Generic Writer: (setf sentry-transport) (object)
Package

sentry-client.

Methods
Writer Method: (setf sentry-transport) ((sentry-client sentry-client))

automatically generated writer method

Source

sentry-client.lisp.

Target Slot

transport.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   E   F   G   I   M   P   R   S   T   W  
Index Entry  Section

(
(setf connection-timeout): Private generic functions
(setf connection-timeout): Private generic functions
(setf dsn): Private generic functions
(setf dsn): Private generic functions
(setf sentry-transport): Private generic functions
(setf sentry-transport): Private generic functions

C
call-with-sentry-client: Private ordinary functions
capture-exception: Public ordinary functions
client-capture-exception: Private generic functions
client-capture-exception: Private generic functions
condition-severity-level: Private generic functions
condition-severity-level: Private generic functions
condition-severity-level: Private generic functions
condition-severity-level: Private generic functions
connection-timeout: Private generic functions
connection-timeout: Private generic functions

D
dsn: Private generic functions
dsn: Private generic functions

E
encode-core-event-attributes: Private ordinary functions
encode-exception: Private ordinary functions
encode-exception-event: Private ordinary functions
encode-sentry-auth-header: Private ordinary functions
encode-stacktrace: Private ordinary functions

F
format-sentry-timestamp: Private ordinary functions
Function, call-with-sentry-client: Private ordinary functions
Function, capture-exception: Public ordinary functions
Function, encode-core-event-attributes: Private ordinary functions
Function, encode-exception: Private ordinary functions
Function, encode-exception-event: Private ordinary functions
Function, encode-sentry-auth-header: Private ordinary functions
Function, encode-stacktrace: Private ordinary functions
Function, format-sentry-timestamp: Private ordinary functions
Function, initialize-sentry-client: Public ordinary functions
Function, make-sentry-client: Private ordinary functions
Function, make-sentry-event-id: Private ordinary functions
Function, parse-dsn: Private ordinary functions
Function, post-sentry-request: Private ordinary functions
Function, read-dsn: Private ordinary functions
Function, sentry-api-url: Private ordinary functions
Function, test-sentry-client: Public ordinary functions

G
Generic Function, (setf connection-timeout): Private generic functions
Generic Function, (setf dsn): Private generic functions
Generic Function, (setf sentry-transport): Private generic functions
Generic Function, client-capture-exception: Private generic functions
Generic Function, condition-severity-level: Private generic functions
Generic Function, connection-timeout: Private generic functions
Generic Function, dsn: Private generic functions
Generic Function, sentry-tags: Public generic functions
Generic Function, sentry-transport: Private generic functions

I
initialize-instance: Public standalone methods
initialize-sentry-client: Public ordinary functions

M
Macro, with-sentry-client: Private macros
Macro, with-sentry-error-handler: Public macros
make-sentry-client: Private ordinary functions
make-sentry-event-id: Private ordinary functions
Method, (setf connection-timeout): Private generic functions
Method, (setf dsn): Private generic functions
Method, (setf sentry-transport): Private generic functions
Method, client-capture-exception: Private generic functions
Method, condition-severity-level: Private generic functions
Method, condition-severity-level: Private generic functions
Method, condition-severity-level: Private generic functions
Method, connection-timeout: Private generic functions
Method, dsn: Private generic functions
Method, initialize-instance: Public standalone methods
Method, sentry-tags: Public generic functions
Method, sentry-transport: Private generic functions

P
parse-dsn: Private ordinary functions
post-sentry-request: Private ordinary functions

R
read-dsn: Private ordinary functions

S
sentry-api-url: Private ordinary functions
sentry-tags: Public generic functions
sentry-tags: Public generic functions
sentry-transport: Private generic functions
sentry-transport: Private generic functions

T
test-sentry-client: Public ordinary functions

W
with-sentry-client: Private macros
with-sentry-error-handler: Public macros