gobrake: github.com/airbrake/gobrake Index | Examples | Files | Directories

package gobrake

import "github.com/airbrake/gobrake"

Index

Examples

Package Files

code_hunk.go filter.go git.go gobrake.go metric.go notice.go notifier.go queries.go queue_metric.go queues.go remote_config.go route_breakdown.go route_metric.go routes.go stack.go stat.go

func GetLogger Uses

func GetLogger() *log.Logger

func NewBlocklistKeysFilter Uses

func NewBlocklistKeysFilter(keys ...interface{}) func(*Notice) *Notice

Code:

notifier := gobrake.NewNotifier(1, "key")
filter := gobrake.NewBlocklistKeysFilter("password", regexp.MustCompile("(?i)(user)"))
notifier.AddFilter(filter)

notice := &gobrake.Notice{
    Params: map[string]interface{}{
        "password": "slds2&LP",
        "User":     "username",
        "email":    "john@example.com",
    },
}
notifier.Notify(notice, nil)

func SetLogger Uses

func SetLogger(l *log.Logger)

type Error Uses

type Error struct {
    Type      string       `json:"type"`
    Message   string       `json:"message"`
    Backtrace []StackFrame `json:"backtrace"`
}

type Metric Uses

type Metric interface {
    Start(c context.Context, name string) (context.Context, Span)
}

func ContextMetric Uses

func ContextMetric(c context.Context) Metric

type Notice Uses

type Notice struct {
    Id    string `json:"-"` // id returned by SendNotice
    Error error  `json:"-"` // error returned by SendNotice

    Errors  []Error                `json:"errors"`
    Context map[string]interface{} `json:"context"`
    Env     map[string]interface{} `json:"environment"`
    Session map[string]interface{} `json:"session"`
    Params  map[string]interface{} `json:"params"`
}

func NewNotice Uses

func NewNotice(e interface{}, req *http.Request, depth int) *Notice

func (*Notice) SetRequest Uses

func (n *Notice) SetRequest(req *http.Request)

func (*Notice) String Uses

func (n *Notice) String() string

type Notifier Uses

type Notifier struct {
    Routes  *routes
    Queries *queryStats
    Queues  *queueStats
    // contains filtered or unexported fields
}

func NewNotifier Uses

func NewNotifier(projectId int64, projectKey string) *Notifier

func NewNotifierWithOptions Uses

func NewNotifierWithOptions(opt *NotifierOptions) *Notifier

func (*Notifier) AddFilter Uses

func (n *Notifier) AddFilter(fn func(*Notice) *Notice)

AddFilter adds filter that can change notice or ignore it by returning nil.

func (*Notifier) Close Uses

func (n *Notifier) Close() error

func (*Notifier) CloseTimeout Uses

func (n *Notifier) CloseTimeout(timeout time.Duration) error

CloseTimeout waits for pending requests to finish and then closes the notifier.

func (*Notifier) Flush Uses

func (n *Notifier) Flush()

Flush waits for pending requests to finish.

func (*Notifier) Notice Uses

func (n *Notifier) Notice(err interface{}, req *http.Request, depth int) *Notice

Notice returns Aibrake notice created from error and request. depth determines which call frame to use when constructing backtrace.

func (*Notifier) Notify Uses

func (n *Notifier) Notify(e interface{}, req *http.Request)

Notify notifies Airbrake about the error.

func (*Notifier) NotifyOnPanic Uses

func (n *Notifier) NotifyOnPanic()

NotifyOnPanic notifies Airbrake about the panic and should be used with defer statement.

func (*Notifier) SendNotice Uses

func (n *Notifier) SendNotice(notice *Notice) (string, error)

SendNotice sends notice to Airbrake.

func (*Notifier) SendNoticeAsync Uses

func (n *Notifier) SendNoticeAsync(notice *Notice)

SendNoticeAsync is like SendNotice, but sends notice asynchronously. Pending notices can be flushed with Flush.

type NotifierOptions Uses

type NotifierOptions struct {
    // Airbrake project id.
    ProjectId int64

    // Airbrake project key.
    ProjectKey string

    // Airbrake host name. Default is https://airbrake.io.
    Host string

    // Airbrake host name for sending APM data.
    APMHost string

    // The host name where the remote config is located.
    RemoteConfigHost string

    // Environment such as production or development.
    Environment string

    // Git revision. Default is SOURCE_VERSION on Heroku.
    Revision string

    // List of keys containing sensitive information that must be filtered out.
    // Default is password, secret.
    KeysBlocklist []interface{}

    // Disables code hunks.
    DisableCodeHunks bool

    // Controls the error reporting feature.
    DisableErrorNotifications bool

    // Controls the error reporting feature.
    DisableAPM bool

    // http.Client that is used to interact with Airbrake API.
    HTTPClient *http.Client
}

func (*NotifierOptions) Copy Uses

func (opt *NotifierOptions) Copy() *NotifierOptions

Makes a shallow copy (without copying slices or nested structs; because we don't need it so far).

type QueryInfo Uses

type QueryInfo struct {
    Method    string
    Route     string
    Query     string
    Func      string
    File      string
    Line      int
    StartTime time.Time
    EndTime   time.Time
}

type QueueMetric Uses

type QueueMetric struct {
    Queue   string
    Errored bool
    // contains filtered or unexported fields
}

func ContextQueueMetric Uses

func ContextQueueMetric(c context.Context) *QueueMetric

func NewQueueMetric Uses

func NewQueueMetric(c context.Context, name string) (context.Context, *QueueMetric)

func (*QueueMetric) Start Uses

func (t *QueueMetric) Start(c context.Context, name string) (context.Context, Span)

func (*QueueMetric) WithSpan Uses

func (t *QueueMetric) WithSpan(ctx context.Context, name string, body func(context.Context) error) error

type RemoteConfigJSON Uses

type RemoteConfigJSON struct {
    ProjectId   int64  `json:"project_id"`
    UpdatedAt   int64  `json:"updated_at"`
    PollSec     int64  `json:"poll_sec"`
    ConfigRoute string `json:"config_route"`

    RemoteSettings []*RemoteSettings `json:"settings"`
}

type RemoteSettings Uses

type RemoteSettings struct {
    Name     string `json:"name"`
    Enabled  bool   `json:"enabled"`
    Endpoint string `json:"endpoint"`
}

type RouteMetric Uses

type RouteMetric struct {
    Method      string
    Route       string
    StatusCode  int
    ContentType string
    // contains filtered or unexported fields
}

func ContextRouteMetric Uses

func ContextRouteMetric(c context.Context) *RouteMetric

func NewRouteMetric Uses

func NewRouteMetric(c context.Context, method, route string) (context.Context, *RouteMetric)

func (*RouteMetric) Start Uses

func (t *RouteMetric) Start(c context.Context, name string) (context.Context, Span)

func (*RouteMetric) WithSpan Uses

func (t *RouteMetric) WithSpan(ctx context.Context, name string, body func(context.Context) error) error

type Span Uses

type Span interface {
    Finish()
}

func ContextSpan Uses

func ContextSpan(c context.Context) Span

type StackFrame Uses

type StackFrame struct {
    File string         `json:"file"`
    Line int            `json:"line"`
    Func string         `json:"function"`
    Code map[int]string `json:"code,omitempty"`
}

Directories

PathSynopsis
beego
gin
internal/lrucache
internal/testpkg1
internal/testpkg2
negroni

Package gobrake imports 24 packages (graph) and is imported by 15 packages. Updated 2020-12-02. Refresh now. Tools for package owners.