Documentation ¶
Overview ¶
Forked from github.com/kisielk/raven-go at revision 1833b9bb1f80ff05746875be4361b52a00c50952 Package raven is a client and library for sending messages and exceptions to Sentry: http://getsentry.com Usage: Create a new client using the NewClient() function. The value for the DSN parameter can be obtained from the project page in the Sentry web interface. After the client has been created use the CaptureMessage method to send messages to the server. client, err := sentry.NewClient(dsn) ... id, err := client.CaptureMessage("some text") If you want to have more finegrained control over the send event, you can create the event instance yourself client.Capture(&sentry.Event{Message: "Some Text", Logger:"auth"})
Index ¶
Constants ¶
const DefaultSentryDSN = "noop://user:password@localhost:0/0"
Default sentry DSN from https://github.com/getsentry/sentry-java/blob/af5196bd2a2531d4a3a74b51aeb64319c82c4ef6/sentry/src/main/java/io/sentry/dsn/Dsn.java#L20
Variables ¶
This section is empty.
Functions ¶
func CaptureErrors ¶
CaptureErrors sets the name of the project so that when events are sent to sentry they are tagged as coming from the given project. It then sets up the connection to sentry and begins to send any errors recieved over comm to sentry. It panics if a client could not be initialized.
func CaptureErrorsAltDsn ¶
CaptureErrorsAltDsn allows you to have errors sent to one of multiple dsn targes. It sets up a connection to sentry for each of the given dsn URIs.
To tag an event with a dsn:
glog.Error("bad thing happened", glog.Data(raven.AltDsn(YOUR_DSN)))
If the dsn of an event is not specified or is not equal to any of the dsns arg, the dsn target will be assumed to be the first dsn in the dsns list.
func Fingerprint ¶
func Fingerprint(print ...string) interface{}
Fingerprint creates a Sentry fingerprint from a variadic set of strings. This fingerprint will be added to the outgoing event to allow for custom rollup. See: https://docs.sentry.io/learn/rollups/#customize-grouping-with-fingerprints
Types ¶
type Client ¶
type Client struct { URL *url.URL PublicKey string SecretKey string Project string Tags map[string]string // contains filtered or unexported fields }
func NewClient ¶
NewClient creates a new client for a server identified by the given dsn A dsn is a string in the form:
{PROTOCOL}://{PUBLIC_KEY}:{SECRET_KEY}@{HOST}/{PATH}{PROJECT_ID}
eg:
http://abcd:efgh@sentry.example.com/sentry/project1
func (Client) Capture ¶
Sends the given event to the sentry servers after encoding it into a byte slice.
func (Client) CaptureGlogEvent ¶
func (Client) CaptureMessage ¶
CaptureMessage sends a message to the Sentry server. The resulting string is an event identifier.
type Event ¶
type Event struct { EventId string `json:"event_id"` Project string `json:"project"` Message string `json:"message"` Timestamp string `json:"timestamp"` Level string `json:"level"` Logger string `json:"logger"` ServerName string `json:"server_name"` StackTrace stacktrace.StackTrace `json:"stacktrace"` Http *Http `json:"request"` TargetDsn string `json:"targetDsn"` Extra map[string]interface{} `json:"extra"` Tags map[string]string `json:"tags"` Fingerprint []string `json:"fingerprint,omitempty"` }