airbrake

package module
v0.0.0-...-bdf7b97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2015 License: MIT Imports: 18 Imported by: 0

README

airbrake

Go Airbrake client - this is very much WORK IN PROGRESS / 1st draft

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQueueFull = errors.New("queue full - event dropped")
)

Functions

func LogDropHandler

func LogDropHandler(e *Event)

func Recoverer

func Recoverer(c *Client, next http.HandlerFunc) http.HandlerFunc

Types

type Airbrake

type Airbrake struct {
	// contains filtered or unexported fields
}

func NewAirbrake

func NewAirbrake(appID, appKey string) *Airbrake

func (*Airbrake) Send

func (a *Airbrake) Send(e *Event, timeout time.Duration) error

type AirbrakeContext

type AirbrakeContext struct {
	OS            string `json:"os,omitempty"`
	Language      string `json:"language,omitempty"`
	Environment   string `json:"environment,omitempty"`
	Version       string `json:"version,omitempty"`
	URL           string `json:"url,omitempty"`
	Action        string `json:"action,omitempty"`
	RootDirectory string `json:"rootDirectory,omitempty"`
	UserID        string `json:"userId,omitempty"`
	UserName      string `json:"userName,omitempty"`
	UserEmail     string `json:"userEmail,omitempty"`
	UserAgent     string `json:"userAgent,omitempty"`
}

type AirbrakeError

type AirbrakeError struct {
	Type      string             `json:"type"`
	Message   string             `json:"message,omitempty"`
	Backtrace []*StacktraceFrame `json:"backtrace"`
}

type AirbrakeNotification

type AirbrakeNotification struct {
	Notifier    notifier          `json:"notifier"`
	Errors      []AirbrakeError   `json:"errors"`
	Context     AirbrakeContext   `json:"context,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
	Session     map[string]string `json:"session,omitempty"`
	Params      map[string]string `json:"params,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(conf *Config) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) HTTPPanic

func (c *Client) HTTPPanic(r *http.Request, w http.ResponseWriter)

func (*Client) HTTPPanicWithCtx

func (c *Client) HTTPPanicWithCtx(r *http.Request, w http.ResponseWriter, ctx context.Context)

type Config

type Config struct {
	MaxQueue int
	MaxConn  int
	Timeout  time.Duration

	Transport Transport
}

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type Event

type Event struct {
	Type string

	Context    map[string]interface{}
	Stacktrace *Stacktrace
}

func NewEvent

func NewEvent(t string) *Event

type Http

type Http struct {
	URL       string
	Method    string
	Query     string
	UserAgent string
	Cookies   []*http.Cookie
	Headers   map[string]string
	Env       map[string]string

	// Must be either a string or map[string]string
	Data interface{}
}

func NewHttp

func NewHttp(req *http.Request) *Http

type Stacktrace

type Stacktrace struct {
	Frames []*StacktraceFrame `json:"frames"`
}

func NewStacktrace

func NewStacktrace(skip int, context int, appPackagePrefixes []string) *Stacktrace

Intialize and populate a new stacktrace, skipping skip frames.

context is the number of surrounding lines that should be included for context. Setting context to 3 would try to get seven lines. Setting context to -1 returns one line with no surrounding context, and 0 returns no context.

appPackagePrefixes is a list of prefixes used to check whether a package should be considered "in app".

func (*Stacktrace) Culprit

func (s *Stacktrace) Culprit() string

type StacktraceFrame

type StacktraceFrame struct {
	// At least one required
	Filename string `json:"file"`
	Function string `json:"function"`
	Line     int    `json:"line"`
	Package  string `json:"package"`

	// Optional
	ContextLine string
	PreContext  []string
	PostContext []string
	InApp       bool
}

func NewStacktraceFrame

func NewStacktraceFrame(pc uintptr, file string, line, context int, appPackagePrefixes []string) *StacktraceFrame

Build a single frame using data returned from runtime.Caller.

context is the number of surrounding lines that should be included for context. Setting context to 3 would try to get seven lines. Setting context to -1 returns one line with no surrounding context, and 0 returns no context.

appPackagePrefixes is a list of prefixes used to check whether a package should be considered "in app".

type Transport

type Transport interface {
	Send(*Event, time.Duration) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL