interfaces

package
v0.0.0-...-de44970 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(value models.Identifier)

func ToAliasKeys

func ToAliasKeys(source map[string]interface{}) map[string]interface{}

TODO return error that contains all unexpected keys

func TrimLength

func TrimLength(v string, length int) string

TrimLength truncates string up to length characters. If given string is shorter than length if will be returned without any changes. TODO move to the strings package

Types

type AppleCrashReport

type AppleCrashReport struct {
}

func (*AppleCrashReport) KeyAlias

func (*AppleCrashReport) KeyAlias() string

func (*AppleCrashReport) KeyCanonical

func (*AppleCrashReport) KeyCanonical() string
type Breadcrumb struct {
	Type      string                 `in:"type"      json:"type"`
	Timestamp time.Time              `in:"timestamp" json:"timestamp"`
	Level     interface{}            `in:"level"     json:"level,omitempty"`
	Message   string                 `in:"message"   json:"message,omitempty"`
	Category  string                 `in:"category"  json:"category,omitempty"`
	Data      map[string]interface{} `in:"data"      json:"data,omitempty"`
	EventID   interface{}            `in:"event_id"  json:"event_id,omitempty"`
}
type Breadcrumbs struct {
	Values []Breadcrumb `in:"values" json:"values"`
}

Breadcrumbs interface stores information that leads up to an error.

- “message“ must be no more than 1000 characters in length.

[{
    "type": "message",
    // timestamp can be ISO format or a unix timestamp (as float)
    "timestamp": "2016-01-17T12:30:00",
    "data": {
        "message": "My raw message with interpreted strings like %s",
    }

], ...}

func (breadcrumbs *Breadcrumbs) DecodeRequest(request map[string]interface{}) error
func (*Breadcrumbs) KeyAlias() string
func (*Breadcrumbs) KeyCanonical() string

type CSP

type CSP struct {
}

func (*CSP) KeyAlias

func (*CSP) KeyAlias() string

func (*CSP) KeyCanonical

func (*CSP) KeyCanonical() string

type Contexts

type Contexts struct{}

func (*Contexts) KeyAlias

func (*Contexts) KeyAlias() string

func (*Contexts) KeyCanonical

func (*Contexts) KeyCanonical() string

type DebugMeta

type DebugMeta struct {
}

func (*DebugMeta) KeyAlias

func (*DebugMeta) KeyAlias() string

func (*DebugMeta) KeyCanonical

func (*DebugMeta) KeyCanonical() string

type Device

type Device struct {
}

func (*Device) KeyAlias

func (*Device) KeyAlias() string

func (*Device) KeyCanonical

func (*Device) KeyCanonical() string

type EventEntry

type EventEntry struct {
	Type  string            `kv:"-" in:"-" json:"type"`
	Value models.Identifier `kv:"-" in:"-" json:"data"`
}

type EventInterfaces

type EventInterfaces struct {
	// Built-in interfaces, sorted by name
	AppleCrashReport *AppleCrashReport `kv:"applecrashreport" in:"applecrashreport" json:"-"`

	Breadcrumbs *Breadcrumbs `kv:"breadcrumbs" in:"breadcrumbs" json:"-"`
	Contexts    *Contexts    `kv:"contexts"    in:"contexts"    json:"contexts,omitempty"`
	CSP         *CSP         `kv:"csp"         in:"csp"         json:"-"`
	DebugMeta   *DebugMeta   `kv:"debug_meta"  in:"debug_meta"  json:"-"`
	Device      *Device      `kv:"devce"       in:"devce"       json:"device,omitempty"`
	Exception   *Exception   `kv:"exception"   in:"exception"   json:"-"`
	LogEntry    *LogEntry    `kv:"logentry"    in:"logentry"    json:"-"`
	Query       *Query       `kv:"query"       in:"query"       json:"-"`
	Repos       *Repos       `kv:"repos"       in:"repos"       json:"-"`
	Request     *HTTP        `kv:"request"     in:"request"     json:"-"`
	SDK         *SDK         `kv:"sdk"         in:"sdk"         json:"sdk,omitempty"`
	Stacktrace  *Stacktrace  `kv:"stacktrace"  in:"stacktrace"  json:"-"`
	Template    *Template    `kv:"template"    in:"template"    json:"-"`
	Threads     *Threads     `kv:"threads"     in:"threads"     json:"-"`
	User        *User        `kv:"user"        in:"user"        json:"user"` // TODO omitempty?

	Message string       `in:"-" json:"message"`
	Entries []EventEntry `in:"-" json:"entries"` // TODO omitempty?
}

func (*EventInterfaces) DecodeRecord

func (event *EventInterfaces) DecodeRecord(record map[string]interface{}) error

func (*EventInterfaces) DecodeRequest

func (event *EventInterfaces) DecodeRequest(request map[string]interface{}) error

type Exception

type Exception struct {
	Values          []ExceptionValue `in:"values" json:"values"`
	HasSystemFrames bool             `in:"-"      json:"hasSystemFrames"`
	ExcOmitted      bool             `in:"-"      json:"excOmitted"`
}

Exception consists of a list of values. In most cases, this list contains a single exception, with an optional stacktrace interface.

Each exception has a mandatory `value` argument and optional `type` and `module` arguments describing the exception class type and module namespace.

You can also optionally bind a stacktrace interface to an exception. The spec is identical to `sentry.interfaces.Stacktrace`.

{
    "values": [{
        "type": "ValueError",
        "value": "My exception value",
        "module": "__builtins__",
        "mechanism": {},
        "stacktrace": {
            // see sentry.interfaces.Stacktrace
        }
    }]
}
Values should be sent oldest to newest, this includes both the stacktrace
and the exception itself.

func (*Exception) DecodeRequest

func (exception *Exception) DecodeRequest(request map[string]interface{}) error

func (*Exception) KeyAlias

func (*Exception) KeyAlias() string

func (*Exception) KeyCanonical

func (*Exception) KeyCanonical() string

type ExceptionValue

type ExceptionValue struct {
	Type            string      `in:"type"       json:"type"`
	Value           string      `in:"value"      json:"value"`
	Module          string      `in:"module"     json:"module"`
	Mechanism       interface{} `in:"mechanism"  json:"mechanism"`
	Stacktrace      Stacktrace  `in:"stacktrace" json:"stacktrace"`
	HasSystemFrames bool        `in:"-"          json:"hasSystemFrames"` // TODO ?
	SlimFrames      bool        `in:"-"          json:"slimFrames"`      // TODO ?
}

type Frame

type Frame struct {
	ColumnNumber       *int    `kv:"colno"              in:"colno"              json:"colNo"`
	LineNumber         int     `kv:"lineno"             in:"lineno"             json:"lineNo"`
	InstructionOffset  *int    `kv:"instruction_offset" in:"instruction_offset" json:"instructionOffset"` // TODO type?
	InstructionAddress *string `kv:"instruction_addr"   in:"instruction_addr"   json:"instructionAddr"`   // TODO type?
	Symbol             *string `kv:"symbol"             in:"-"                  json:"symbol"`            // TODO type?
	SymbolAddress      *string `kv:"symbol_addr"        in:"symbol_addr"        json:"symbolAddr"`        // TODO type?
	AbsolutePath       string  `kv:"abs_path"           in:"abs_path"           json:"absPath"`
	Module             string  `kv:"module"             in:"module"             json:"module"`
	Package            *string `kv:"package"            in:"package"            json:"package"`
	Platform           *string `kv:"platform"           in:"platform"           json:"platform"` // TODO type?
	Errors             *string `kv:"errors"             in:"-"                  json:"errors"`   // TODO type?
	InApp              bool    `kv:"in_app"             in:"in_app"             json:"inApp"`
	Filename           string  `kv:"filename"           in:"filename"           json:"filename"`
	Function           string  `kv:"function"           in:"function"           json:"function"`

	Context         FrameContext                `kv:"-"            in:"-"            json:"context"`
	ContextLineNode string                      `kv:"context_line" in:"context_line" json:"-"`
	PreContextNode  []string                    `kv:"pre_context"  in:"pre_context"  json:"-"`
	PostContextNode []string                    `kv:"post_context" in:"post_context" json:"-"`
	Variables       map[string]interface{}      `kv:"-"            in:"vars"         json:"vars"`
	VariablesNode   map[interface{}]interface{} `kv:"vars"         in:"-"            json:"-"`
}

TODO https://docs.sentry.io/clientdev/interfaces/stacktrace/ image_addr symbol?

type FrameContext

type FrameContext []FrameContextLine

type FrameContextLine

type FrameContextLine struct {
	LineNumber int
	Line       string
}

func (FrameContextLine) MarshalJSON

func (contextLine FrameContextLine) MarshalJSON() ([]byte, error)

type HTTP

type HTTP struct {
	Headers map[string]string `json:"headers"`
	URL     string            `json:"url"`
}

func (*HTTP) KeyAlias

func (*HTTP) KeyAlias() string

func (*HTTP) KeyCanonical

func (*HTTP) KeyCanonical() string

type LogEntry

type LogEntry struct {
	Message   string        `kv:"message"   in:"message"   json:"message"`
	Formatted string        `kv:"formatted" in:"formatted" json:"-"`
	Params    []interface{} `kv:"params"    in:"params"    json:"-"`
}

LogEntry is an interface consisted of a “message“ arg, an an optional “params“ arg for formatting, and an optional “formatted“ message which is the result of “message“ combined with “params“.

If your message cannot be parameterized, then the message interface will serve no benefit.

- “message“ must be no more than 1000 characters in length.

{
    "message": "My raw message with interpreted strings like %s",
    "formatted": "My raw message with interpreted strings like this",
    "params": ["this"]
}

func (*LogEntry) KeyAlias

func (*LogEntry) KeyAlias() string

func (*LogEntry) KeyCanonical

func (*LogEntry) KeyCanonical() string

type Query

type Query struct {
}

func (*Query) KeyAlias

func (*Query) KeyAlias() string

func (*Query) KeyCanonical

func (*Query) KeyCanonical() string

type Repo

type Repo struct {
	Name     string  `kv:"name"     in:"name"     json:"name"`
	Prefix   string  `kv:"prefix"   in:"prefix"   json:"prefix"`
	Revision *string `kv:"revision" in:"revision" json:"revision"`
}

Repo contains details about one repository for the Repos interface.

type Repos

type Repos map[string]Repo

Repos contains details about repositories connected to an event. This is primarily used to aid with mapping the application code's filepath to the equivilent path inside of a repository.

{
    "/abs/path/to/sentry": {
        "name": "getsentry/sentry",
        "prefix": "src",
        "revision": "..." // optional
    }
}

func (*Repos) KeyAlias

func (*Repos) KeyAlias() string

func (*Repos) KeyCanonical

func (*Repos) KeyCanonical() string

type SDK

type SDK struct {
	Name     string   `kv:"name"      in:"name"    json:"name"`
	Version  string   `kv:"version"   in:"version" json:"version"`
	ClientIP string   `kv:"client_ip" in:"-"       json:"clientIP"`
	Upstream Upstream `json:"upstream"  in:"-"`
}

The SDK used to transmit this event.

{
    "name": "sentry-unity",
    "version": "1.0"
}

func (*SDK) DecodeRecord

func (sdk *SDK) DecodeRecord(record map[string]interface{}) error

func (*SDK) KeyAlias

func (*SDK) KeyAlias() string

func (*SDK) KeyCanonical

func (*SDK) KeyCanonical() string

type Stacktrace

type Stacktrace struct {
	HasSystemFrames bool    `kv:"has_system_frames" in:"-"      json:"hasSystemFrames"`
	FramesOmitted   *bool   `kv:"frames_omitted"    in:"-"      json:"framesOmitted"` // TODO type?
	Frames          []Frame `kv:"frames"            in:"frames" json:"frames"`
}

func (*Stacktrace) DecodeRecord

func (stacktrace *Stacktrace) DecodeRecord(record map[string]interface{}) error

func (*Stacktrace) KeyAlias

func (*Stacktrace) KeyAlias() string

func (*Stacktrace) KeyCanonical

func (*Stacktrace) KeyCanonical() string

type Template

type Template struct {
}

func (*Template) KeyAlias

func (*Template) KeyAlias() string

func (*Template) KeyCanonical

func (*Template) KeyCanonical() string

type Threads

type Threads struct {
}

func (*Threads) KeyAlias

func (*Threads) KeyAlias() string

func (*Threads) KeyCanonical

func (*Threads) KeyCanonical() string

type Upstream

type Upstream struct {
	Name    string `json:"name"`
	URL     string `json:"url"`
	IsNewer bool   `json:"isNewer"`
}

type User

type User struct {
	ID        string `in:"id"         json:"id"`
	Username  string `in:"username"   json:"username"`
	Email     string `in:"email"      json:"email"`
	IPAddress string `in:"ip_address" json:"ip_address"`
	// TODO Does Sentry allows arbitrary key/value pairs for User interface?
	Extra map[string]string `in:"-"   json:"-"`
}

User is an interface which describes the authenticated User for a request.

You should provide **at least** either an `id` (a unique identifier for an authenticated user) or `ip_address` (their IP address).

All other attributes are optional.

{
    "id": "unique_id",
    "username": "my_user",
    "email": "foo@example.com"
    "ip_address": "127.0.0.1",
    "optional": "value"
}

func (*User) DecodeRequest

func (user *User) DecodeRequest(request map[string]interface{}) error

func (*User) KeyAlias

func (*User) KeyAlias() string

func (*User) KeyCanonical

func (*User) KeyCanonical() string

Jump to

Keyboard shortcuts

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