clientdb

package
v1.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DumpAll     = "all"
	DumpSpans   = "spans"
	DumpLogs    = "logs"
	DumpMetrics = "metrics"
)
View Source
const CollectGarbageAfter = time.Hour

CollectGarbageAfter is the time after which a store is considered garbage.

Variables

This section is empty.

Functions

func Dump

func Dump(ctx context.Context, root, clientID, selection string, out io.Writer) error

Dump writes the selected persisted stream rows as JSON lines. It opens files read-only and is intended for a closed store, whose tails have been flushed.

func LogsToPB added in v0.13.1

func LogsToPB(dbLog []Log) []*otlplogsv1.ResourceLogs

func MarshalProtoJSONs added in v0.13.1

func MarshalProtoJSONs[T proto.Message](protos []T) ([]byte, error)

func MetricsToPB added in v0.13.6

func MetricsToPB(dbMetrics []Metric) []*otlpmetricsv1.ResourceMetrics

func UnmarshalProtoJSONs added in v0.13.1

func UnmarshalProtoJSONs[T proto.Message](pb []byte, base T, out *[]T) error

Types

type AppendStats

type AppendStats struct {
	LastID          int64
	CapWaitDuration time.Duration
	SpillLagRows    int
	SpillLagBytes   int64
}

AppendStats describes the append-side work and the stream backlog visible when an append returns. CapWaitDuration is non-zero only when the hard memory cap applied backpressure to the caller.

type DB added in v0.19.7

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

DB is one client's standalone append-only telemetry store.

func (*DB) AppendLogs

func (s *DB) AppendLogs(rows []Log) (AppendStats, error)

func (*DB) AppendMetrics

func (s *DB) AppendMetrics(rows []Metric) (AppendStats, error)

func (*DB) AppendSpans

func (s *DB) AppendSpans(rows []Span) (AppendStats, error)

func (*DB) Close added in v0.19.7

func (s *DB) Close() error

func (*DB) Read

func (s *DB) Read() *DB

Read mirrors the current DB handle seam. The append-only store needs no separate read pool, so selectors are bound to the same immutable streams.

func (*DB) SelectLogsBeneathSpan

func (s *DB) SelectLogsBeneathSpan(ctx context.Context, arg SelectLogsBeneathSpanParams) ([]Log, error)

func (*DB) SelectLogsSince

func (s *DB) SelectLogsSince(ctx context.Context, arg SelectLogsSinceParams) ([]Log, error)

func (*DB) SelectMetricsSince

func (s *DB) SelectMetricsSince(ctx context.Context, arg SelectMetricsSinceParams) ([]Metric, error)

func (*DB) SelectSpan

func (s *DB) SelectSpan(ctx context.Context, arg SelectSpanParams) (Span, error)

func (*DB) SelectSpansSince

func (s *DB) SelectSpansSince(ctx context.Context, arg SelectSpansSinceParams) ([]Span, error)

type DBs

type DBs struct {
	Root string
	// contains filtered or unexported fields
}

DBs owns the refcounted set of open per-client telemetry stores. Stream files persist after the final Close and are recovered on the next Open, including their ID sequences and span lookup maps.

func NewDBs

func NewDBs(root string) *DBs

func (*DBs) GC

func (r *DBs) GC(keep map[string]bool) error

GC removes complete client stores whose newest stream (or transitional SQLite sidecar) is older than CollectGarbageAfter. Grouping files by client keeps a recently active stream from being separated from an older sibling.

func (*DBs) Open

func (r *DBs) Open(ctx context.Context, clientID string) (*DB, error)

type Log

type Log struct {
	ID                   int64
	TraceID              sql.NullString
	SpanID               sql.NullString
	Timestamp            int64
	SeverityNumber       int64
	SeverityText         string
	Body                 []byte
	Attributes           []byte
	InstrumentationScope []byte
	Resource             []byte
	ResourceSchemaURL    string
}

type Metric added in v0.13.6

type Metric struct {
	ID   int64
	Data []byte
}

type SelectLogsBeneathSpanParams added in v0.19.0

type SelectLogsBeneathSpanParams struct {
	SpanID sql.NullString
	ID     int64
	Limit  int64
}

type SelectLogsSinceParams

type SelectLogsSinceParams struct {
	ID    int64
	Limit int64
}

type SelectMetricsSinceParams added in v0.13.6

type SelectMetricsSinceParams struct {
	ID    int64
	Limit int64
}

type SelectSpanParams added in v0.19.0

type SelectSpanParams struct {
	TraceID string
	SpanID  string
}

type SelectSpansSinceParams

type SelectSpansSinceParams struct {
	ID    int64
	Limit int64
}

type Span

type Span struct {
	ID                     int64
	TraceID                string
	SpanID                 string
	TraceState             string
	ParentSpanID           sql.NullString
	Flags                  int64
	Name                   string
	Kind                   string
	StartTime              int64
	EndTime                sql.NullInt64
	Attributes             []byte
	DroppedAttributesCount int64
	Events                 []byte
	DroppedEventsCount     int64
	Links                  []byte
	DroppedLinksCount      int64
	StatusCode             int64
	StatusMessage          string
	InstrumentationScope   []byte
	Resource               []byte
	ResourceSchemaURL      string
}

func (*Span) ReadOnly

func (span *Span) ReadOnly() sdktrace.ReadOnlySpan

Jump to

Keyboard shortcuts

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