Documentation
¶
Index ¶
- Constants
- type Breadcrumb
- type BreadcrumbList
- type Contexts
- type EnvelopeHeader
- type EnvelopeItem
- type ErrorEvent
- type ExceptionList
- type ExceptionValue
- type FlexibleMessage
- type FlexibleTS
- type ItemHeader
- type LogEntry
- type LogEnvelope
- type LogRecord
- type Mechanism
- type MetricEnvelope
- type MetricRecord
- type Module
- func (m *Module) HTTPHandler() module.HTTPIngestionHandler
- func (m *Module) Name() string
- func (m *Module) OnInit(db *sql.DB) error
- func (m *Module) PreviewMapper() event.PreviewMapper
- func (m *Module) RegisterMigrations(migrator *storage.Migrator) error
- func (m *Module) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
- func (m *Module) SetBroadcaster(b module.Broadcaster)
- func (m *Module) Type() string
- type RawSpan
- type SDK
- type SpanData
- type SpansEnvelope
- type TraceContext
- type Transaction
Constants ¶
const StoredEvent = "sentry.stored"
StoredEvent is the WebSocket notice that structured rows were stored: logs, metrics or traces, which create no feed card and so no "event.received". Its payload names the project and the kinds - "log", "metric", "trace" -, never the rows, so the Sentry tabs know which list to fetch again.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breadcrumb ¶
type Breadcrumb struct {
Type string `json:"type"`
Category string `json:"category"`
Level string `json:"level"`
Message string `json:"message"`
Timestamp FlexibleTS `json:"timestamp"`
Data json.RawMessage `json:"data"`
}
type BreadcrumbList ¶
type BreadcrumbList struct {
Values []Breadcrumb `json:"values"`
}
func (*BreadcrumbList) UnmarshalJSON ¶
func (b *BreadcrumbList) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts both shapes Sentry SDKs emit for breadcrumbs: the "interface" object form {"values": [...]} (Python/PHP) and the bare-array form [...] (sentry.javascript / SvelteKit). Without this, a JS error event fails to parse and never lands in the sentry tables.
type Contexts ¶
type Contexts struct {
Trace *TraceContext `json:"trace"`
}
type EnvelopeHeader ¶
type EnvelopeHeader struct {
EventID string `json:"event_id"`
SentAt string `json:"sent_at"`
DSN string `json:"dsn"`
}
EnvelopeHeader is the first line of a Sentry envelope.
type EnvelopeItem ¶
type EnvelopeItem struct {
Type string // "event", "transaction", "spans", "log", "session", etc.
Header json.RawMessage // raw item header JSON
Payload json.RawMessage // raw item body JSON
}
EnvelopeItem represents a single parsed item from a Sentry envelope.
type ErrorEvent ¶
type ErrorEvent struct {
EventID string `json:"event_id"`
Timestamp FlexibleTS `json:"timestamp"`
Platform string `json:"platform"`
Level string `json:"level"`
Logger string `json:"logger"`
Transaction string `json:"transaction"`
ServerName string `json:"server_name"`
Environment string `json:"environment"`
Release string `json:"release"`
Message FlexibleMessage `json:"message"`
LogEntry *LogEntry `json:"logentry"`
Exception *ExceptionList `json:"exception"`
Breadcrumbs *BreadcrumbList `json:"breadcrumbs"`
Contexts *Contexts `json:"contexts"`
SDK *SDK `json:"sdk"`
Request json.RawMessage `json:"request"`
Modules json.RawMessage `json:"modules"`
Extra json.RawMessage `json:"extra"`
Tags json.RawMessage `json:"tags"`
}
ErrorEvent represents a parsed Sentry error event.
type ExceptionList ¶
type ExceptionList struct {
Values []ExceptionValue `json:"values"`
}
func (*ExceptionList) UnmarshalJSON ¶
func (e *ExceptionList) UnmarshalJSON(data []byte) error
UnmarshalJSON also accepts a bare array of exceptions (sentry-go).
type ExceptionValue ¶
type ExceptionValue struct {
Type string `json:"type"`
Value string `json:"value"`
Mechanism *Mechanism `json:"mechanism"`
Stacktrace json.RawMessage `json:"stacktrace"`
}
type FlexibleMessage ¶
type FlexibleMessage struct {
Text string // plain message or the "formatted" / "message" fallback
Template string // the original template (message field from object form)
Params []string // interpolation parameters
}
FlexibleMessage handles Sentry "message" which can be a plain string or an object {"message":"...", "params":[...], "formatted":"..."}.
func (FlexibleMessage) String ¶
func (m FlexibleMessage) String() string
String returns the display text.
func (*FlexibleMessage) UnmarshalJSON ¶
func (m *FlexibleMessage) UnmarshalJSON(data []byte) error
type FlexibleTS ¶
type FlexibleTS struct {
// contains filtered or unexported fields
}
FlexibleTS handles Sentry timestamps which can be either a numeric epoch (float64, used by SDK v3/v4) or an ISO 8601 string (used by SDK v2).
func (FlexibleTS) Number ¶
func (t FlexibleTS) Number() json.Number
Number returns the underlying json.Number for use with parseTimestamp.
func (*FlexibleTS) UnmarshalJSON ¶
func (t *FlexibleTS) UnmarshalJSON(data []byte) error
type ItemHeader ¶
ItemHeader is the header line before each item body.
type LogEnvelope ¶
type LogEnvelope struct {
Items []LogRecord `json:"items"`
}
LogEnvelope represents a Sentry log envelope item body.
type LogRecord ¶
type LogRecord struct {
TraceID string `json:"trace_id"`
SpanID string `json:"span_id"`
Level string `json:"level"`
SeverityNumber int `json:"severity_number"`
Body string `json:"body"`
Timestamp FlexibleTS `json:"timestamp"`
Attributes map[string]any `json:"attributes"`
}
LogRecord represents a single Sentry native log entry.
type MetricEnvelope ¶
type MetricEnvelope struct {
Items []MetricRecord `json:"items"`
}
MetricEnvelope represents a Sentry "trace_metric" envelope item body.
type MetricRecord ¶
type MetricRecord struct {
TraceID string `json:"trace_id"`
SpanID string `json:"span_id"`
Name string `json:"name"`
Type string `json:"type"`
Value float64 `json:"value"`
Unit string `json:"unit"`
Timestamp json.Number `json:"timestamp"`
Attributes map[string]any `json:"attributes"`
}
MetricRecord represents a single Sentry trace metric: a counter, gauge or distribution value, linked to the trace and span it was recorded in.
type Module ¶
type Module struct {
module.BaseModule
// contains filtered or unexported fields
}
func (*Module) HTTPHandler ¶
func (m *Module) HTTPHandler() module.HTTPIngestionHandler
func (*Module) PreviewMapper ¶
func (m *Module) PreviewMapper() event.PreviewMapper
func (*Module) RegisterMigrations ¶
func (*Module) RegisterProtectedRoutes ¶
func (m *Module) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
RegisterProtectedRoutes adds the Sentry UI API behind the API auth. SDK ingestion (envelope/store) goes through the HTTP handler and stays open.
func (*Module) SetBroadcaster ¶
func (m *Module) SetBroadcaster(b module.Broadcaster)
SetBroadcaster implements module.Broadcasting.
type RawSpan ¶
type RawSpan struct {
SpanID string `json:"span_id"`
ParentSpanID string `json:"parent_span_id"`
TraceID string `json:"trace_id"`
Op string `json:"op"`
Description string `json:"description"`
Status string `json:"status"`
StartTimestamp FlexibleTS `json:"start_timestamp"`
Timestamp FlexibleTS `json:"timestamp"`
IsSegment bool `json:"is_segment"`
Data SpanData `json:"data"`
}
RawSpan represents a span within a transaction or spans envelope item.
func (*RawSpan) UnmarshalJSON ¶
UnmarshalJSON also accepts the Span v2 format (SDK v4 "span" items): name, end_timestamp and typed attributes {"key":{"type":"string","value":...}}.
type SpanData ¶
SpanData holds span attributes. SDKs put more than strings in there: numbers and booleans as well (http.response.status_code: 200, http.request.redirect: false). With the declared map[string]string a single numeric attribute made the whole envelope item fail to unmarshal, so the transaction and all of its spans were dropped. Values are normalized to strings, which keeps existing consumers (classifySpan, extractServiceName, the spans table) unchanged.
func (*SpanData) UnmarshalJSON ¶
type SpansEnvelope ¶
type SpansEnvelope struct {
Items []RawSpan `json:"items"`
}
SpansEnvelope represents a Sentry spans (v2) envelope item body.
type TraceContext ¶
type Transaction ¶
type Transaction struct {
EventID string `json:"event_id"`
Type string `json:"type"`
Transaction string `json:"transaction"`
Timestamp FlexibleTS `json:"timestamp"`
StartTime FlexibleTS `json:"start_timestamp"`
Platform string `json:"platform"`
Environment string `json:"environment"`
Release string `json:"release"`
Contexts *Contexts `json:"contexts"`
Spans []RawSpan `json:"spans"`
Measurements json.RawMessage `json:"measurements"`
SDK *SDK `json:"sdk"`
// Root span fields
Op string `json:"op,omitempty"`
Status string `json:"status,omitempty"`
}
Transaction represents a Sentry transaction envelope item.