core

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchItemResult

type BatchItemResult struct {
	ID      string `json:"id,omitempty"`
	EventID string `json:"eventId,omitempty"`
	GroupID string `json:"groupId,omitempty"`
	Status  string `json:"status,omitempty"`
}

type Config

type Config struct {
	Providers        []Provider
	Pond             *pond.Pond
	Now              func() time.Time
	EventIDGenerator func() string
	SDK              map[string]any
	Runtime          map[string]any
	Platform         string
}

type Duck

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

func NewDuck

func NewDuck(config Config) *Duck

func (*Duck) AddBreadcrumb

func (d *Duck) AddBreadcrumb(breadcrumb map[string]any)

func (*Duck) CaptureTransaction

func (d *Duck) CaptureTransaction(transaction *Transaction)

func (*Duck) CaptureTransactionContext

func (d *Duck) CaptureTransactionContext(ctx context.Context, transaction *Transaction)

func (*Duck) ClearBreadcrumbs

func (d *Duck) ClearBreadcrumbs()

func (*Duck) ClearTags

func (d *Duck) ClearTags()

func (*Duck) ClearUser

func (d *Duck) ClearUser()

func (*Duck) Flush

func (d *Duck) Flush(ctx context.Context)

func (*Duck) Log added in v0.2.0

func (d *Duck) Log(level any, message string, details any)

func (*Duck) LogContext added in v0.2.0

func (d *Duck) LogContext(ctx context.Context, level any, message string, details any)

func (*Duck) LogContextAt added in v0.2.0

func (d *Duck) LogContextAt(ctx context.Context, at time.Time, level any, message string, details any)

func (*Duck) Pond

func (d *Duck) Pond() *pond.Pond

func (*Duck) Quack

func (d *Duck) Quack(err error)

func (*Duck) QuackContext

func (d *Duck) QuackContext(ctx context.Context, err error)

func (*Duck) QuackContextDetails added in v0.2.0

func (d *Duck) QuackContextDetails(ctx context.Context, err error, details any, handled bool, mechanism string)

func (*Duck) QuackDetails added in v0.2.0

func (d *Duck) QuackDetails(err error, details any, handled bool, mechanism string)

func (*Duck) QuackRecoveredPanicContext added in v0.2.0

func (d *Duck) QuackRecoveredPanicContext(ctx context.Context, recovered any, mechanism string)

func (*Duck) RegisterProvider

func (d *Duck) RegisterProvider(provider Provider)

func (*Duck) SetDist

func (d *Duck) SetDist(value string)

func (*Duck) SetEnvironment

func (d *Duck) SetEnvironment(value string)

func (*Duck) SetExtra

func (d *Duck) SetExtra(value map[string]any)

func (*Duck) SetFingerprint

func (d *Duck) SetFingerprint(value string)

func (*Duck) SetPlatform

func (d *Duck) SetPlatform(value string)

func (*Duck) SetRelease

func (d *Duck) SetRelease(value string)

func (*Duck) SetRequestID

func (d *Duck) SetRequestID(value string)

func (*Duck) SetRuntime

func (d *Duck) SetRuntime(value map[string]any)

func (*Duck) SetSDK

func (d *Duck) SetSDK(value map[string]any)

func (*Duck) SetServerName

func (d *Duck) SetServerName(value string)

func (*Duck) SetService

func (d *Duck) SetService(value string)

func (*Duck) SetTag

func (d *Duck) SetTag(key string, value any)

func (*Duck) SetTags

func (d *Duck) SetTags(tags map[string]any)

func (*Duck) SetTrace

func (d *Duck) SetTrace(traceID, spanID string)

func (*Duck) SetTransaction

func (d *Duck) SetTransaction(value string)

func (*Duck) SetUser

func (d *Duck) SetUser(user map[string]any)

func (*Duck) StartTransaction

func (d *Duck) StartTransaction(name string, op string) *Transaction

type Event

type Event struct {
	Type    EventType
	Payload map[string]any
}

func NewEvent

func NewEvent(eventType EventType, payload map[string]any) Event

type EventType

type EventType string
const (
	EventTypeError       EventType = "errors"
	EventTypeLog         EventType = "logs"
	EventTypeTransaction EventType = "transactions"
)

type FailureInfo

type FailureInfo struct {
	Type    EventType
	Items   []map[string]any
	Result  TransportResult
	Message string
}

type FlushableProvider

type FlushableProvider interface {
	Provider
	Flush(ctx context.Context)
}

type Level

type Level string
const (
	LevelDebug Level = "DEBUG"
	LevelInfo  Level = "INFO"
	LevelWarn  Level = "WARN"
	LevelError Level = "ERROR"
	LevelFatal Level = "FATAL"
)

func NormalizeLevel

func NormalizeLevel(level any) Level

type Provider

type Provider interface {
	CaptureEvent(ctx context.Context, event Event)
}

type Span

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

func (*Span) Finish

func (s *Span) Finish(status string, endTimestampMs ...int64) *Span

func (*Span) ParentSpanID

func (s *Span) ParentSpanID() string

func (*Span) SetData

func (s *Span) SetData(data map[string]any) *Span

func (*Span) SpanID

func (s *Span) SpanID() string

func (*Span) TraceID

func (s *Span) TraceID() string

type Transaction

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

func (*Transaction) AddMeasurement

func (t *Transaction) AddMeasurement(key string, value any, unit string) *Transaction

func (*Transaction) Context

func (t *Transaction) Context() any

func (*Transaction) DurationMs

func (t *Transaction) DurationMs() int64

func (*Transaction) EndTimestampMs

func (t *Transaction) EndTimestampMs() *int64

func (*Transaction) Finish

func (t *Transaction) Finish(status string, endTimestampMs ...int64) *Transaction

func (*Transaction) Measurements

func (t *Transaction) Measurements() map[string]any

func (*Transaction) Name

func (t *Transaction) Name() string

func (*Transaction) Op

func (t *Transaction) Op() string

func (*Transaction) ParentSpanID

func (t *Transaction) ParentSpanID() string

func (*Transaction) SetContext

func (t *Transaction) SetContext(value any) *Transaction

func (*Transaction) SetParentSpanID

func (t *Transaction) SetParentSpanID(value string) *Transaction

func (*Transaction) SpanID

func (t *Transaction) SpanID() string

func (*Transaction) Spans

func (t *Transaction) Spans() []*Span

func (*Transaction) StartChild

func (t *Transaction) StartChild(op string, description string) *Span

func (*Transaction) StartTimestampMs

func (t *Transaction) StartTimestampMs() int64

func (*Transaction) Status

func (t *Transaction) Status() string

func (*Transaction) TraceID

func (t *Transaction) TraceID() string

type TransportResult

type TransportResult struct {
	StatusCode   int
	ResponseBody string
	ErrorMessage string
	Attempts     int
	Duplicate    bool
	Items        []BatchItemResult
}

func (TransportResult) IsSuccess

func (r TransportResult) IsSuccess() bool

Jump to

Keyboard shortcuts

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