41 lines
1.6 KiB
Go
41 lines
1.6 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
"git.tornberg.me/go-otel/internal/websocket"
|
|
)
|
|
|
|
// SearchOptions narrows a Search call beyond the free-text query.
|
|
type SearchOptions struct {
|
|
// Query is a case-insensitive substring match against the raw entry JSON.
|
|
Query string
|
|
// Type restricts results to a single telemetry type (traces, metrics, logs).
|
|
// Empty matches any type.
|
|
Type string
|
|
// Since restricts results to entries with Timestamp >= Since (unix nanoseconds).
|
|
// Zero means no lower bound.
|
|
Since int64
|
|
// Until restricts results to entries with Timestamp <= Until (unix nanoseconds).
|
|
// Zero means no upper bound.
|
|
Until int64
|
|
}
|
|
|
|
// Store interface for telemetry history persistence.
|
|
type Store interface {
|
|
Append(ctx context.Context, entry websocket.HistoryEntry) error
|
|
GetHistory(ctx context.Context, limit int) ([]websocket.HistoryEntry, error)
|
|
Search(ctx context.Context, opts SearchOptions, limit int) ([]websocket.HistoryEntry, error)
|
|
}
|
|
|
|
// StatsQuerier is implemented by stores that can answer aggregate
|
|
// time-series questions (currently ClickHouseStore). The stats HTTP
|
|
// endpoints are only enabled when the configured store implements it.
|
|
type StatsQuerier interface {
|
|
// ErrorStats returns hourly/daily total and error entry counts.
|
|
ErrorStats(ctx context.Context, service string, hours int, daily bool) ([]StatsPoint, error)
|
|
// ReleaseSeries returns per-release error-count time series.
|
|
ReleaseSeries(ctx context.Context, service string, hours int) (map[string][]StatsPoint, error)
|
|
// Services lists distinct services seen in the rollup.
|
|
Services(ctx context.Context) ([]string, error)
|
|
}
|