storage

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStorageFull = errors.New("storage full")

ErrStorageFull signals that telemetry can't be stored because the database is at its size cap (and can't be pruned further) or the disk is out of space. Receivers map it to a retryable response (HTTP 503 / gRPC RESOURCE_EXHAUSTED).

Functions

func IsStorageFull added in v0.2.0

func IsStorageFull(err error) bool

IsStorageFull reports whether err is (or wraps) a storage-full condition — our sentinel, an ENOSPC errno, or a DuckDB/OS out-of-space message.

func WithoutTracing added in v0.2.0

func WithoutTracing(ctx context.Context) context.Context

WithoutTracing returns ctx with GORM span creation suppressed for the storage OTel plugin. See pipeline self-telemetry handling.

Types

type Batcher added in v0.2.0

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

Batcher buffers hot-path rows and flushes them via the DuckDB Appender API.

func (*Batcher) AppendLog added in v0.2.0

func (b *Batcher) AppendLog(l *Log) error

AppendLog buffers a log record for batched insertion.

func (*Batcher) AppendMetric added in v0.2.0

func (b *Batcher) AppendMetric(m *Metric) error

AppendMetric buffers a metric data point for batched insertion.

func (*Batcher) AppendSpan added in v0.2.0

func (b *Batcher) AppendSpan(s *Span) error

AppendSpan buffers a span for batched insertion. The generated duration_ns column is omitted — DuckDB computes it from start_ns/end_ns.

func (*Batcher) Close added in v0.2.0

func (b *Batcher) Close() error

Close stops the interval flusher, flushes remaining rows, and releases the pinned connections. It is idempotent.

func (*Batcher) Flush added in v0.2.0

func (b *Batcher) Flush() error

Flush flushes every appender's buffered rows so they become visible to readers. It is safe to call concurrently with append.

type CompactResult

type CompactResult struct {
	BytesBefore int64 `json:"bytes_before"`
	BytesAfter  int64 `json:"bytes_after"`
	Reclaimed   int64 `json:"reclaimed"`
}

CompactResult reports bytes before and after a CHECKPOINT + VACUUM cycle.

type DB

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

func Open

func Open(path string) (*DB, error)

func (*DB) ActiveSessionID

func (d *DB) ActiveSessionID() string

func (*DB) ActiveSessionLabel

func (d *DB) ActiveSessionLabel() string

func (*DB) AppendLog added in v0.2.0

func (d *DB) AppendLog(l *Log) error

AppendLog buffers a log record for batched insertion.

func (*DB) AppendMetric added in v0.2.0

func (d *DB) AppendMetric(m *Metric) error

AppendMetric buffers a metric data point for batched insertion.

func (*DB) AppendSpan added in v0.2.0

func (d *DB) AppendSpan(s *Span) error

AppendSpan buffers a span for batched insertion via the columnar Appender. Rows become durable on the next flush; ingest callers flush at the end of each request, so reads-after-ingest within a request observe the row.

func (*DB) Close

func (d *DB) Close() error

func (*DB) Compact

func (d *DB) Compact() (*CompactResult, error)

Compact runs CHECKPOINT followed by VACUUM to return free pages to the OS.

func (*DB) CreateImportedSession

func (d *DB) CreateImportedSession(label string) (*Session, error)

func (*DB) CreateSession

func (d *DB) CreateSession(label string, isBaseline bool) (*Session, error)

func (*DB) DeleteSession

func (d *DB) DeleteSession(id string) error

func (*DB) FileSize added in v0.2.0

func (d *DB) FileSize() int64

FileSize returns the on-disk footprint of the database (main file + WAL), or 0 for an in-memory database.

func (*DB) FlushBatch added in v0.2.0

func (d *DB) FlushBatch() error

FlushBatch flushes all buffered hot-path rows so they are visible to readers. Ingest paths call this at the end of a request and before running detectors.

func (*DB) Full added in v0.2.0

func (d *DB) Full() bool

Full reports whether the storage is currently full (writes rejected). It's an atomic snapshot maintained by the storage guard and ingest write failures.

func (*DB) GetMetricSeries

func (d *DB) GetMetricSeries(f MetricSeriesFilter) ([]*Metric, error)

GetMetricSeries returns every data point matching the filter, ordered by timestamp ascending. Histogram percentiles arrive as separate rows; callers split them apart by attributes.percentile.

func (*DB) GetServiceMap

func (d *DB) GetServiceMap(sessionID string) (*ServiceMapData, error)

func (*DB) GetServiceP95 added in v0.2.0

func (d *DB) GetServiceP95(serviceName string) (int64, error)

GetServiceP95 returns the p95 duration_ns for spans of the given service. Returns 0 (no error) when there are no stored spans for that service yet.

func (*DB) GetSession

func (d *DB) GetSession(id string) (*Session, error)

func (*DB) GetSourceStats added in v0.2.0

func (d *DB) GetSourceStats(sessionID string) ([]SourceStats, error)

GetSourceStats returns per-service ingest stats for the given session (or all sessions when sessionID is ""). Rates are derived from received_at.

func (*DB) GetSpan

func (d *DB) GetSpan(spanID string) (*Span, error)

func (*DB) GetSpansBySession

func (d *DB) GetSpansBySession(sessionID string) ([]*Span, error)

GetSpansBySession returns all spans for a session, ordered by start time.

func (*DB) GetStats

func (d *DB) GetStats(sessionID string) (*Stats, error)

func (*DB) GetStorageBreakdown

func (d *DB) GetStorageBreakdown() (*StorageBreakdown, error)

GetStorageBreakdown returns per-table sizes via duckdb_tables() and a per-session estimate based on the serialised span attribute lengths.

func (*DB) GetTrace

func (d *DB) GetTrace(traceID string) ([]*Span, error)

func (*DB) GetTraceIssues

func (d *DB) GetTraceIssues(traceID string) ([]*TraceIssue, error)

func (*DB) Gorm added in v0.2.0

func (d *DB) Gorm() *gorm.DB

Gorm exposes the underlying *gorm.DB for callers that want to build queries.

func (*DB) InsertLintWarning

func (d *DB) InsertLintWarning(w *LintWarning) error

func (*DB) InsertLog

func (d *DB) InsertLog(l *Log) error

func (*DB) InsertMetric

func (d *DB) InsertMetric(m *Metric) error

InsertMetric stores one metric data point.

func (*DB) InsertSpan

func (d *DB) InsertSpan(s *Span) error

func (*DB) InsertSpanEvents

func (d *DB) InsertSpanEvents(events []*SpanEvent) error

InsertSpanEvents bulk-inserts the events attached to a span. Empty input is a no-op; on error any rows inserted before the failure are not rolled back (events are best-effort, not transactional, like spans).

func (d *DB) InsertSpanLinks(links []*SpanLink) error

InsertSpanLinks bulk-inserts links emitted by a span. Best-effort: not transactional, mirroring InsertSpanEvents.

func (*DB) ListEventsBySpan

func (d *DB) ListEventsBySpan(spanID string) ([]*SpanEvent, error)

ListEventsBySpan returns the events attached to a single span, in time order.

func (d *DB) ListIncomingLinks(linkedTraceID string) ([]*SpanLink, error)

ListIncomingLinks returns every link in the store whose target is the given trace ID — the "who links into this trace?" reverse lookup.

func (*DB) ListLinksBySpan

func (d *DB) ListLinksBySpan(spanID string) ([]*SpanLink, error)

ListLinksBySpan returns the outbound links emitted by a single span.

func (*DB) ListLinksByTrace

func (d *DB) ListLinksByTrace(traceID string) ([]*SpanLink, error)

ListLinksByTrace returns all span_links whose trace_id matches — used to bulk-attach links to spans when serving GET /api/traces/:id so the waterfall can show the link badge without a per-span round-trip.

func (*DB) ListLintWarnings

func (d *DB) ListLintWarnings(sessionID string) ([]*LintWarning, error)

func (*DB) ListLogs

func (d *DB) ListLogs(f LogFilter) ([]*Log, error)

func (*DB) ListMetricCatalog

func (d *DB) ListMetricCatalog(sessionID string) ([]*MetricCatalogEntry, error)

ListMetricCatalog returns one entry per (service, name) seen in the session. Pass "" to ignore the session filter.

func (*DB) ListServices

func (d *DB) ListServices(sessionID string) ([]string, error)

ListServices returns distinct service names. An empty sessionID returns services across all sessions; a non-empty one scopes to that session.

func (*DB) ListSessions

func (d *DB) ListSessions() ([]*Session, error)

func (*DB) ListSpans

func (d *DB) ListSpans(f SpanFilter) ([]*SpanRow, error)

ListSpans returns a flat list of spans with computed tag (n+1/slow/lint/error). Tags are derived from trace_issues (n+1), status_code (error), duration (slow), and lint_warnings (lint). Priority: n+1 > error > slow > lint.

func (*DB) ListTraceIssuesBySession

func (d *DB) ListTraceIssuesBySession(sessionID string) ([]*TraceIssue, error)

ListTraceIssuesBySession returns every detector finding for a session.

func (*DB) ListTraces

func (d *DB) ListTraces(f TraceFilter) ([]*TraceRow, error)

func (*DB) ListTracesInWindow

func (d *DB) ListTracesInWindow(f TraceOverlayFilter) ([]*TraceOverlay, error)

ListTracesInWindow returns root spans (traces) whose start_ns falls in the [FromNs, ToNs] window for use as chart overlay markers. Caps at f.Limit (default 50).

func (*DB) LoadDropCounters added in v0.2.0

func (d *DB) LoadDropCounters() (spans, logs, metrics int64, err error)

LoadDropCounters reads the persisted drop counters from the meta table. Returns zeros (no error) if not yet written.

func (*DB) Path

func (d *DB) Path() string

Path returns the underlying DuckDB file path (":memory:" for in-memory DBs).

func (*DB) Prune

func (d *DB) Prune(cfg RetentionConfig, activeID string) (PruneResult, error)

Prune applies the retention policy. The activeID and any baseline sessions are never deleted, regardless of age or count.

func (*DB) ReadOnlyQuery added in v0.2.0

func (d *DB) ReadOnlyQuery(ctx context.Context, query string, maxRows int) (cols []string, rows [][]any, truncated bool, err error)

ReadOnlyQuery runs query against a read-only DuckDB connection to the same database file and returns the result columns and rows (capped at maxRows; truncated reports whether more rows were available). []byte values are converted to strings so they marshal cleanly to JSON.

Read-only is enforced by DuckDB itself: the connection attaches the database in read_only mode, so the engine rejects any write/DDL/COPY/ATTACH with an error, while reads of any kind (including multiple statements and DuckDB-specific syntax) run normally. A fresh connection is opened per call so results reflect the latest committed data (the server writes through a separate read-write handle).

This requires a file-backed database; an in-memory database can't be reopened read-only as a second instance.

func (*DB) Reset

func (d *DB) Reset() error

Reset wipes all telemetry data (spans, logs, lint warnings, trace issues, sessions). The active session pointer in memory is cleared.

func (*DB) SQL

func (d *DB) SQL() *sql.DB

SQL exposes the underlying *sql.DB for callers that need to run statements outside the curated API (seed fixtures, ad-hoc migrations). Prefer the typed methods above for anything in the hot path.

func (*DB) SaveDropCounters added in v0.2.0

func (d *DB) SaveDropCounters(spans, logs, metrics int64) error

SaveDropCounters writes the current drop counters to the meta table.

func (*DB) Search

func (d *DB) Search(query, sessionID string, limit int) ([]*SearchResult, error)

Search runs a cross-table search against spans, logs, sessions, and services. It also supports field:value filters; currently lint:<rule> (with the alias n+1 == n_plus_one) which returns traces flagged by the linter or detectors.

func (*DB) SetActiveSession

func (d *DB) SetActiveSession(id, label string)

func (*DB) SetBaseline

func (d *DB) SetBaseline(id string, isBaseline bool) error

func (*DB) SetFull added in v0.2.0

func (d *DB) SetFull(v bool)

SetFull updates the full state. Set true when the size cap is hit and can't be pruned, or a write fails for lack of space; false once space is available.

func (*DB) SetSpanielVersion added in v0.2.0

func (d *DB) SetSpanielVersion(version string) error

SetSpanielVersion records the running binary version in the meta table. It is informational (surfaced in doctor/settings); schema versioning is owned by the migrations table. Best-effort by design — callers may ignore the error.

func (*DB) SpanielVersion added in v0.2.0

func (d *DB) SpanielVersion() string

SpanielVersion returns the spaniel version recorded in the meta table, or "".

func (*DB) UpdateSession added in v0.2.0

func (d *DB) UpdateSession(id string, p SessionPatch) error

func (*DB) UpsertTraceIssue

func (d *DB) UpsertTraceIssue(issue *TraceIssue) error

func (*DB) WithContext added in v0.2.0

func (d *DB) WithContext(ctx context.Context) *DB

WithContext returns a shallow copy of DB whose GORM queries carry ctx, so the OTel plugin (see otel.go) nests DuckDB query spans under the caller's span. Use it on request paths: store.WithContext(req.Context()).ListTraces(...). Batcher (Appender) writes bypass GORM and are unaffected; instrument those with an explicit span at the call site.

type LintWarning

type LintWarning struct {
	SpanID    string `json:"span_id"`
	TraceID   string `json:"trace_id"`
	SessionID string `json:"session_id"`
	RuleID    string `json:"rule_id"`
	Message   string `json:"message"`
	Severity  string `json:"severity"`
	CreatedAt int64  `json:"created_at"`
}

func (LintWarning) TableName added in v0.2.0

func (LintWarning) TableName() string

type Log

type Log struct {
	TimestampNs int64  `json:"timestamp_ns"`
	TraceID     string `json:"trace_id"`
	SpanID      string `json:"span_id"`
	Severity    int    `json:"severity"`
	Body        string `json:"body"`
	Attributes  string `json:"attributes"`
	ServiceName string `json:"service_name"`
	SessionID   string `json:"session_id"`
	ReceivedAt  int64  `json:"received_at"`
}

func (Log) TableName added in v0.2.0

func (Log) TableName() string

type LogFilter

type LogFilter struct {
	SessionID string
	TraceID   string
	SpanID    string
	Limit     int
	Page      int
}

type Metric

type Metric struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Unit        string  `json:"unit"`
	Type        string  `json:"type"` // gauge | counter | histogram
	TimestampNs int64   `json:"timestamp_ns"`
	Value       float64 `json:"value"`
	Attributes  string  `json:"attributes"`
	Exemplars   string  `json:"exemplars"` // JSON array of {trace_id, span_id}
	ServiceName string  `json:"service_name"`
	SessionID   string  `json:"session_id"`
}

Metric is one data point of an OTLP metric (gauge, counter, or one percentile of a histogram). Histogram data points are stored as three rows (p50/p95/p99) with the percentile encoded in attributes.percentile.

func (Metric) TableName added in v0.2.0

func (Metric) TableName() string

type MetricCatalogEntry

type MetricCatalogEntry struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Unit        string `json:"unit"`
	Type        string `json:"type"`
	ServiceName string `json:"service_name"`
	SampleCount int    `json:"sample_count"`
}

MetricCatalogEntry summarizes one (name, service) metric stream.

type MetricSeriesFilter

type MetricSeriesFilter struct {
	Name      string
	Service   string
	SessionID string
	FromNs    int64 // inclusive; 0 = no lower bound
	ToNs      int64 // inclusive; 0 = no upper bound
}

MetricSeriesFilter scopes a series query.

type PruneResult

type PruneResult struct {
	DeletedByAge     int   `json:"deleted_by_age"`
	DeletedByCount   int   `json:"deleted_by_count"`
	DeletedBySize    int   `json:"deleted_by_size"`
	FinalSessions    int   `json:"final_sessions"`
	FinalDBSizeBytes int64 `json:"final_db_size_bytes"`
}

PruneResult summarizes what a Prune run did. Useful for logging and tests.

type RetentionConfig

type RetentionConfig struct {
	MaxAge         time.Duration // delete sessions older than this
	MaxSessions    int           // keep at most this many sessions
	MaxDBSizeBytes int64         // shrink to at most this many bytes on disk
}

RetentionConfig describes the retention policy applied by Prune. A zero value for any field disables that particular limit.

type SearchResult

type SearchResult struct {
	Kind      string `json:"kind"` // "trace" | "span" | "session" | "service" | "log"
	TraceID   string `json:"trace_id"`
	SpanID    string `json:"span_id,omitempty"`
	Title     string `json:"title"`
	Subtitle  string `json:"subtitle"`
	SessionID string `json:"session_id"`
}

SearchResult is one item returned by the global search.

type ServiceMapData

type ServiceMapData struct {
	Nodes []*ServiceMapNode `json:"nodes"`
	Edges []*ServiceMapEdge `json:"edges"`
}

type ServiceMapEdge

type ServiceMapEdge struct {
	From          string `json:"from"`
	To            string `json:"to"`
	CallCount     int    `json:"call_count"`
	AvgDurationNs int64  `json:"avg_duration_ns"`
	ErrorCount    int    `json:"error_count"`
}

type ServiceMapNode

type ServiceMapNode struct {
	ID         string             `json:"id"`
	SpanCount  int                `json:"span_count"`
	ErrorCount int                `json:"error_count"`
	P95Ns      int64              `json:"p95_ns"`
	TopOps     []ServiceMapOpStat `json:"top_operations" gorm:"-"`
}

type ServiceMapOpStat

type ServiceMapOpStat struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
	P95Ns int64  `json:"p95_ns"`
}

ServiceMapOpStat is one (operation name, count, p95) entry for the node inspector panel. Capped server-side to keep the response cheap.

type Session

type Session struct {
	ID             string `json:"id" gorm:"primaryKey"`
	Label          string `json:"label"`
	CreatedAt      int64  `json:"created_at"`
	IsBaseline     bool   `json:"is_baseline"`
	IsImported     bool   `json:"is_imported"`
	SpanCount      int    `json:"span_count"`
	TraceCount     int    `json:"trace_count" gorm:"-"` // computed via join, not a column
	Services       string `json:"services"`
	Note           string `json:"note"`
	LastActivityNs int64  `json:"last_activity_ns"`
	P95Ns          int64  `json:"p95_ns" gorm:"-"`      // computed from spans
	SizeBytes      int64  `json:"size_bytes" gorm:"-"`  // approx from attribute payload
	N1Count        int    `json:"n1_count" gorm:"-"`    // trace_issues with kind='n_plus_one'
	ErrorCount     int    `json:"error_count" gorm:"-"` // spans with status_code=2
}

func (Session) TableName added in v0.2.0

func (Session) TableName() string

type SessionPatch added in v0.2.0

type SessionPatch struct {
	Label *string
	Note  *string
}

SessionPatch holds the mutable user-facing fields that PATCH /api/sessions/{id} may change. A nil pointer means "leave unchanged"; an empty string is a valid value.

type SessionSize

type SessionSize struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	ApproxBytes int64  `json:"approx_bytes"`
	SpanCount   int    `json:"span_count"`
}

type SourceStats added in v0.2.0

type SourceStats struct {
	Service        string  `json:"service"`
	AcceptedPerSec float64 `json:"accepted_per_sec"`
	RejectedPerSec float64 `json:"rejected_per_sec"`
	ErrorRate      float64 `json:"error_rate"`
	BytesPerSec    float64 `json:"bytes_per_sec"`
	LastSeenNs     int64   `json:"last_seen_ns"`
}

SourceStats is a rolling-window snapshot for one service.name source. Defined here (not in ingestion) so api and ingestion can both reference it without a circular import.

type Span

type Span struct {
	TraceID       string       `json:"trace_id"`
	SpanID        string       `json:"span_id"`
	ParentSpanID  string       `json:"parent_span_id"`
	ServiceName   string       `json:"service_name"`
	Name          string       `json:"name"`
	Kind          int          `json:"kind"`
	StartNs       int64        `json:"start_ns"`
	EndNs         int64        `json:"end_ns"`
	DurationNs    int64        `json:"duration_ns" gorm:"->"` // generated column, read-only
	StatusCode    int          `json:"status_code"`
	StatusMessage string       `json:"status_message"`
	Attributes    string       `json:"attributes"`
	Resource      string       `json:"resource"`
	SessionID     string       `json:"session_id"`
	SessionLabel  string       `json:"session_label"`
	ReceivedAt    int64        `json:"received_at"`
	Sampled       bool         `json:"sampled"`
	Events        []*SpanEvent `json:"events" gorm:"-"`
	Links         []*SpanLink  `json:"links" gorm:"-"`
}

func (Span) TableName added in v0.2.0

func (Span) TableName() string

type SpanEvent

type SpanEvent struct {
	SpanID     string `json:"span_id"`
	TraceID    string `json:"trace_id"`
	SessionID  string `json:"session_id"`
	TimeNs     int64  `json:"time_ns"`
	Name       string `json:"name"`
	Attributes string `json:"attributes"`
}

func (SpanEvent) TableName added in v0.2.0

func (SpanEvent) TableName() string

type SpanFilter

type SpanFilter struct {
	SessionID string
	Sort      string // "time" | "dur" | "name"
	Limit     int
}
type SpanLink struct {
	SpanID        string `json:"span_id"`
	TraceID       string `json:"trace_id"`
	SessionID     string `json:"session_id"`
	LinkedTraceID string `json:"linked_trace_id"`
	LinkedSpanID  string `json:"linked_span_id"`
	TraceState    string `json:"trace_state"`
	Attributes    string `json:"attributes"`
}

SpanLink is a causal/relational pointer from one span to another span (potentially in a different trace). OTel uses these for fan-out work items, batched jobs, async retries — anywhere a span was caused by something not on its direct parent chain.

func (SpanLink) TableName added in v0.2.0

func (SpanLink) TableName() string

type SpanRow

type SpanRow struct {
	Span
	Tag string `json:"tag,omitempty"`
}

type Stats

type Stats struct {
	SpanCount           int   `json:"span_count"`
	TraceCount          int   `json:"trace_count"`
	LogCount            int   `json:"log_count"`
	DBSize              int64 `json:"db_size"`
	SessionCount        int   `json:"session_count"`
	OldestSessionAt     int64 `json:"oldest_session_at"`
	DroppedSpans        int64 `json:"dropped_spans"`
	DroppedLogs         int64 `json:"dropped_logs"`
	DroppedMetricPoints int64 `json:"dropped_metric_points"`
	LastDropAt          int64 `json:"last_drop_at"`
	StorageFull         bool  `json:"storage_full"` // ingestion paused: DB at cap / disk full
	Throughput                // live ingest rates, filled by the API layer
}

type StorageBreakdown

type StorageBreakdown struct {
	Tables           []TableStat   `json:"tables"`
	Sessions         []SessionSize `json:"sessions"` // top 10 by approx bytes
	WALBytes         int64         `json:"wal_bytes"`
	MainBytes        int64         `json:"main_bytes"`
	LastCheckpointAt int64         `json:"last_checkpoint_at"`
}

StorageBreakdown gives a per-table and per-session storage summary for the Settings UI and the `spaniel compact` command.

type TableStat

type TableStat struct {
	Name        string `json:"name"`
	RowCount    int64  `json:"row_count"`
	ApproxBytes int64  `json:"approx_bytes"`
}

type Throughput added in v0.2.0

type Throughput struct {
	SpansPerSec     float64 `json:"spans_per_sec"`
	LogsPerSec      float64 `json:"logs_per_sec"`
	MetricsPerSec   float64 `json:"metrics_per_sec"`
	PeakSpansPerSec float64 `json:"peak_spans_per_sec"`
}

Throughput is a rolling per-second count of ingested telemetry, averaged over the last few seconds. Computed in-memory by the ingestion pipeline.

type TraceFilter

type TraceFilter struct {
	SessionID string
	Service   string
	Limit     int
	Page      int
}

type TraceIssue

type TraceIssue struct {
	ID            string `json:"id" gorm:"primaryKey"`
	TraceID       string `json:"trace_id"`
	SessionID     string `json:"session_id"`
	Kind          string `json:"kind"`
	Fingerprint   string `json:"fingerprint"`
	Count         int    `json:"count"`
	WastedNs      int64  `json:"wasted_ns"`
	ParentSpanID  string `json:"parent_span_id"`
	ExampleSpanID string `json:"example_span_id"`
	CreatedAt     int64  `json:"created_at"`
}

func (TraceIssue) TableName added in v0.2.0

func (TraceIssue) TableName() string

type TraceOverlay

type TraceOverlay struct {
	TraceID    string `json:"trace_id"`
	Op         string `json:"op"`
	Service    string `json:"service"`
	StatusCode int    `json:"status_code"`
	StartNs    int64  `json:"start_ns"`
	EndNs      int64  `json:"end_ns"`
	DurationNs int64  `json:"duration_ns"`
}

TraceOverlay is the lightweight row returned to the frontend for the metrics chart overlay + correlated-traces panel — just enough to draw a marker and link out to /traces/:id.

type TraceOverlayFilter

type TraceOverlayFilter struct {
	Service   string
	SessionID string
	FromNs    int64
	ToNs      int64
	Limit     int
}

TraceOverlayFilter scopes the "traces during this window" query used by the metrics chart overlay. Service narrows by the metric's service name; SessionID by the active session when set. FromNs/ToNs are inclusive.

type TraceRow

type TraceRow struct {
	TraceID       string   `json:"trace_id"`
	ServiceName   string   `json:"service_name"`
	Name          string   `json:"name"`
	StatusCode    int      `json:"status_code"`
	StartNs       int64    `json:"start_ns"`
	EndNs         int64    `json:"end_ns"`
	DurationNs    int64    `json:"duration_ns"`
	SessionID     string   `json:"session_id"`
	SessionLabel  string   `json:"session_label"`
	HasN1         bool     `json:"has_n1"`
	SpanCount     int      `json:"span_count"`
	IssueKinds    []string `json:"issue_kinds" gorm:"-"`
	IssueKindsRaw string   `json:"-"           gorm:"column:issue_kinds_raw"`
}

Jump to

Keyboard shortcuts

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