sqlite

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is a SQLite-backed implementation of store.Store.

Two *sql.DB handles point at the same file:

  • writer: MaxOpenConns=1. All mutations go through this pool; the single connection serializes writes, which is what SQLite's WAL wants anyway.
  • reader: MaxOpenConns=N. Readers share the WAL with the writer and don't block each other.

func Open

func Open(ctx context.Context, path string) (*Store, error)

Open opens (or creates) the SQLite file at path and applies the schema.

func (*Store) Clear

func (s *Store) Clear(ctx context.Context) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) GetTrace

func (s *Store) GetTrace(ctx context.Context, traceIDHex string) (store.TraceDetail, error)

func (*Store) ListFieldValues

func (s *Store) ListFieldValues(ctx context.Context, f store.ValueFilter) ([]string, error)

func (*Store) ListFields

func (s *Store) ListFields(ctx context.Context, f store.FieldFilter) ([]store.FieldInfo, error)

func (*Store) ListQueryHistory added in v0.11.0

func (s *Store) ListQueryHistory(ctx context.Context, limit int) ([]store.QueryHistoryEntry, error)

ListQueryHistory returns rows ordered by last_run_ns DESC, capped at limit.

func (*Store) ListServices

func (s *Store) ListServices(ctx context.Context) ([]store.ServiceSummary, error)

func (*Store) ListSpanNames

func (s *Store) ListSpanNames(ctx context.Context, service, prefix string, limit int) ([]string, error)

func (*Store) ListTraces

func (s *Store) ListTraces(ctx context.Context, f store.TraceFilter) ([]store.TraceSummary, string, error)

func (*Store) ReaderDB

func (s *Store) ReaderDB() *sql.DB

func (*Store) RecordQueryRun added in v0.11.0

func (s *Store) RecordQueryRun(ctx context.Context, dataset, queryJSON, displayText string, hash []byte) error

RecordQueryRun upserts a query_history row keyed by the content hash. First run inserts with run_count = 1; subsequent runs update last_run_ns and increment run_count. When the table crosses queryHistoryCap rows, the oldest entries by last_run_ns are trimmed.

func (*Store) Retain

func (s *Store) Retain(ctx context.Context, olderThanNS int64) error

func (*Store) RunQuery

func (s *Store) RunQuery(
	ctx context.Context,
	sqlStr string,
	args []any,
	columns []store.QueryColumn,
	hasBucket bool,
	groupKeys []string,
	rates []store.QueryRateSpec,
) (store.QueryResult, error)

func (*Store) SearchLogs

func (s *Store) SearchLogs(ctx context.Context, f store.LogFilter) ([]store.LogOut, string, error)

func (*Store) WriteBatch

func (s *Store) WriteBatch(ctx context.Context, b store.Batch) error

WriteBatch persists one ingest batch inside a single transaction.

Order: resources → scopes → events → span_events → span_links → metric_events → attribute_keys → attribute_values.

func (*Store) WriterDB

func (s *Store) WriterDB() *sql.DB

Exported accessors used by sibling files in this package.

Jump to

Keyboard shortcuts

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