Documentation
¶
Index ¶
- Constants
- func QueueJob(db *sql.DB, id string) (map[string]any, error)
- func QueueJobs(db *sql.DB, q url.Values) (map[string]any, error)
- type Breadcrumb
- type BreadcrumbList
- type Contexts
- type EnvelopeHeader
- type EnvelopeItem
- type ErrorEvent
- type ExceptionList
- type ExceptionValue
- type Feedback
- 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) OnEventsDeleted(uuids []string)
- func (m *Module) OnInit(db *sql.DB) error
- func (m *Module) PreviewMapper() event.PreviewMapper
- func (m *Module) PruneBefore(ctx context.Context, cutoff time.Time) (int, error)
- func (m *Module) RegisterMigrations(migrator *storage.Migrator) error
- func (m *Module) RegisterProtectedRoutes(mux *http.ServeMux, protect func(http.Handler) http.Handler)
- func (m *Module) RegisterRoutes(mux *http.ServeMux, _ event.Store)
- func (m *Module) SetBroadcaster(b module.Broadcaster)
- func (m *Module) SetSourceFetch(mode string)
- func (m *Module) Type() string
- type RawSpan
- type SDK
- type SpanData
- type SpansEnvelope
- type TraceContext
- type Transaction
Constants ¶
const ( // SourceFetchPrivate fetches only from loopback and private addresses // (127.0.0.0/8, ::1, 10/8, 172.16/12, 192.168/16, fc00::/7): the dev // server, a docker service, ddev. The default. SourceFetchPrivate = "private" // SourceFetchAny fetches from any host. SourceFetchAny = "any" // SourceFetchOff never fetches. SourceFetchOff = "off" )
Source fetch modes, config sentry.source_fetch.
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 ¶
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"`
// Trace is the dynamic sampling context. @sentry/node puts the
// environment only here, not in a check_in item.
Trace struct {
Environment string `json:"environment"`
} `json:"trace"`
}
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 Feedback ¶ added in v2.13.0
type Feedback struct {
EventID string // the error it is about; "" when none
FeedbackID string // the feedback event's own id; "" for user_report
Name string
Email string
Message string
URL string
Source string
Payload json.RawMessage
}
Feedback is one piece of user feedback, normalized from either item type.
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"`
// Set by the OTLP receiver only: "otel" (empty = "sentry") and the
// resource service.name.
Source string `json:"-"`
ServiceName string `json:"-"`
}
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 FlexibleTS `json:"timestamp"` // epoch seconds, or RFC 3339 from sentry-go (time.Time)
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) OnEventsDeleted ¶ added in v2.11.0
OnEventsDeleted removes the structured copy of deleted error events.
func (*Module) PreviewMapper ¶
func (m *Module) PreviewMapper() event.PreviewMapper
func (*Module) PruneBefore ¶ added in v2.11.0
PruneBefore deletes Sentry rows older than cutoff that no event card keeps: logs and metrics by received_at, transactions and spans by start_ts (or, without one, by their trace's last_seen), and structured errors whose card is already gone. Errors of a kept (pinned) card stay. It implements module.AgePruner for retention.max_age.
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) RegisterRoutes ¶ added in v2.13.0
RegisterRoutes adds the open cron check-in routes: /ping/{slug} and Sentry's /api/{project}/cron/{slug}/{key}/. Like SDK ingestion they need no API auth.
func (*Module) SetBroadcaster ¶
func (m *Module) SetBroadcaster(b module.Broadcaster)
SetBroadcaster implements module.Broadcasting.
func (*Module) SetSourceFetch ¶ added in v2.11.0
SetSourceFetch sets where source code of JS frames may be fetched from: SourceFetchPrivate (default), SourceFetchAny or SourceFetchOff.
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"`
// Set by the OTLP receiver only. Source is "otel" (empty = "sentry");
// Attrs, when set, is stored as the span's attributes instead of Data,
// so nested values (otel.events, otel.links, ...) stay JSON, not strings.
Source string `json:"-"`
Attrs map[string]any `json:"-"`
}
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"`
ServerName string `json:"server_name"`
// Root span fields
Op string `json:"op,omitempty"`
Status string `json:"status,omitempty"`
}
Transaction represents a Sentry transaction envelope item.
Source Files
¶
- api.go
- api_exceptions.go
- api_feedback.go
- api_logs.go
- api_metrics.go
- api_queues.go
- api_service_map.go
- api_traces.go
- cron_api.go
- cron_checker.go
- cron_ingest.go
- cron_schedule.go
- cron_store.go
- embed.go
- envelope.go
- facets.go
- fingerprint.go
- handler.go
- module.go
- n_plus_one.go
- otlp.go
- preview.go
- queue_jobs.go
- retention.go
- source_context.go
- sourcemap.go
- span_classifier.go
- store_error.go
- store_feedback.go
- store_log.go
- store_metric.go
- store_transaction.go
- trace_graphs.go
- trace_sequence.go
- types.go