observability

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnavailable = errors.New("observability backend unavailable")
)

Functions

This section is empty.

Types

type ClickHouseClient

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

func NewClickHouseClient

func NewClickHouseClient(endpoint, database, username, password string, httpClient *http.Client) (*ClickHouseClient, error)

func (*ClickHouseClient) Events

func (c *ClickHouseClient) Events(ctx context.Context, scope Scope, query EventQuery) ([]Event, error)

func (*ClickHouseClient) LiveLogs

func (c *ClickHouseClient) LiveLogs(ctx context.Context, scope Scope, query LiveLogQuery) (LogBatch, error)

func (*ClickHouseClient) LogWatermark

func (c *ClickHouseClient) LogWatermark(ctx context.Context) (LogCursor, error)

func (*ClickHouseClient) Logs

func (c *ClickHouseClient) Logs(ctx context.Context, scope Scope, query LogQuery) (LogPage, error)

type CombinedReader

type CombinedReader struct {
	Telemetry *ClickHouseClient
	MetricsDB *VictoriaMetricsClient
}

func (CombinedReader) CurrentMetrics

func (c CombinedReader) CurrentMetrics(ctx context.Context, scope Scope, at time.Time) (MetricSnapshot, error)

func (CombinedReader) Events

func (c CombinedReader) Events(ctx context.Context, scope Scope, query EventQuery) ([]Event, error)

func (CombinedReader) LiveLogs

func (c CombinedReader) LiveLogs(ctx context.Context, scope Scope, query LiveLogQuery) (LogBatch, error)

func (CombinedReader) LogWatermark

func (c CombinedReader) LogWatermark(ctx context.Context) (LogCursor, error)

func (CombinedReader) Logs

func (c CombinedReader) Logs(ctx context.Context, scope Scope, query LogQuery) (LogPage, error)

func (CombinedReader) Metrics

func (c CombinedReader) Metrics(ctx context.Context, scope Scope, query MetricQuery) (Metrics, error)

type Event

type Event struct {
	Timestamp time.Time `json:"timestamp"`
	Source    string    `json:"source"`
	Type      string    `json:"type"`
	Reason    string    `json:"reason"`
	Message   string    `json:"message"`
}

type EventQuery

type EventQuery struct {
	From  time.Time
	To    time.Time
	Limit int
}

type EventReader

type EventReader interface {
	Events(context.Context, Scope, EventQuery) ([]Event, error)
}

type LiveLogQuery

type LiveLogQuery struct {
	After  LogCursor
	Search string
	Limit  int
}

type LogBatch

type LogBatch struct {
	Items  []LogEntry
	Cursor LogCursor
}

type LogCursor

type LogCursor struct {
	IngestedAt time.Time
	ID         string
}

func (LogCursor) Valid

func (cursor LogCursor) Valid() bool

type LogEntry

type LogEntry struct {
	ID        string    `json:"id"`
	Timestamp time.Time `json:"timestamp"`
	Body      string    `json:"body"`
	Severity  string    `json:"severity"`
	// contains filtered or unexported fields
}

type LogPage

type LogPage struct {
	Items      []LogEntry
	Next       *LogPosition
	LiveCursor LogCursor
}

type LogPosition

type LogPosition struct {
	Timestamp time.Time
	ID        string
}

func (LogPosition) Valid

func (position LogPosition) Valid() bool

type LogQuery

type LogQuery struct {
	From     time.Time
	To       time.Time
	Search   string
	Limit    int
	Snapshot LogCursor
	Before   *LogPosition
}

type LogReader

type LogReader interface {
	LogWatermark(context.Context) (LogCursor, error)
	Logs(context.Context, Scope, LogQuery) (LogPage, error)
	LiveLogs(context.Context, Scope, LiveLogQuery) (LogBatch, error)
}

type MetricPoint

type MetricPoint struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

type MetricQuery

type MetricQuery struct {
	From time.Time
	To   time.Time
	Step time.Duration
}

type MetricReader

type MetricReader interface {
	Metrics(context.Context, Scope, MetricQuery) (Metrics, error)
	CurrentMetrics(context.Context, Scope, time.Time) (MetricSnapshot, error)
}

type MetricSample

type MetricSample struct {
	Name      string    `json:"name"`
	Unit      string    `json:"unit"`
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

type MetricSeries

type MetricSeries struct {
	Name   string        `json:"name"`
	Unit   string        `json:"unit"`
	Points []MetricPoint `json:"points"`
}

type MetricSnapshot

type MetricSnapshot struct {
	ObservedAt  time.Time      `json:"observedAt"`
	Partial     bool           `json:"partial"`
	Unavailable []string       `json:"unavailable"`
	Samples     []MetricSample `json:"samples"`
}

type Metrics

type Metrics struct {
	From              time.Time      `json:"from"`
	To                time.Time      `json:"to"`
	Step              string         `json:"step"`
	ResolutionSeconds int            `json:"resolutionSeconds"`
	Partial           bool           `json:"partial"`
	Unavailable       []string       `json:"unavailable"`
	Series            []MetricSeries `json:"series"`
}

type Reader

type Reader interface {
	LogReader
	MetricReader
	EventReader
}

type Scope

type Scope struct {
	Namespace   string
	RuntimeName string
}

type UnavailableReader

type UnavailableReader struct{}

func (UnavailableReader) CurrentMetrics

func (UnavailableReader) Events

func (UnavailableReader) LiveLogs

func (UnavailableReader) LogWatermark

func (UnavailableReader) LogWatermark(context.Context) (LogCursor, error)

func (UnavailableReader) Logs

func (UnavailableReader) Metrics

type VictoriaMetricsClient

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

func NewVictoriaMetricsClient

func NewVictoriaMetricsClient(endpoint string, httpClient *http.Client) (*VictoriaMetricsClient, error)

func (*VictoriaMetricsClient) CurrentMetrics

func (c *VictoriaMetricsClient) CurrentMetrics(ctx context.Context, scope Scope, at time.Time) (MetricSnapshot, error)

func (*VictoriaMetricsClient) Metrics

func (c *VictoriaMetricsClient) Metrics(ctx context.Context, scope Scope, query MetricQuery) (Metrics, error)

Jump to

Keyboard shortcuts

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