Documentation
¶
Overview ¶
Package loki implements observe.LogStore against a Loki backend (the light optional sink). It is Core-tier only: it re-emits the parsed Query AST to Loki's HTTP API (it never parses LogQL — the ObserveService does that and hands this store the AST, which renderLogQL turns back into a LogQL string) and writes via Loki's push API.
Loki is object-storage-native: chunks flush to S3/GCS as the primary durable store, so this adapter has no tiering of its own — long retention is a Loki deployment concern, not the adapter's (plan §6.4).
Index ¶
- type Config
- type Store
- func (s *Store) Capabilities() observe.Capabilities
- func (s *Store) Execute(ctx context.Context, q *observe.Query) (observe.ResultStream, error)
- func (s *Store) Health(ctx context.Context) error
- func (s *Store) Labels(ctx context.Context, sel observe.Selector) ([]observe.LabelValue, error)
- func (s *Store) Write(ctx context.Context, batch []observe.LogRecord) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BaseURL is the Loki HTTP endpoint (e.g. http://loki:3100).
BaseURL string
// TenantID is sent as the X-Scope-OrgID header for multi-tenant Loki.
// Empty for single-tenant deployments.
TenantID string
// Timeout bounds a single HTTP request to Loki. Zero uses a default.
Timeout time.Duration
// HTTPClient overrides the client used for requests. nil uses a default.
HTTPClient *http.Client
}
Config configures the Loki store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Loki-backed observe.LogStore.
func (*Store) Capabilities ¶
func (s *Store) Capabilities() observe.Capabilities
Capabilities reports the Loki capability handshake: Core tier only. No raw SQL, no percentiles, no cheap high-cardinality filters (cardinality is Loki's OOM failure mode).
func (*Store) Execute ¶
Execute renders the AST to LogQL and runs it against Loki's query_range endpoint, wrapping the streamed JSON in a ResultStream. RawSQL and Advanced- tier aggregations (percentiles) are rejected with ErrCapabilityUnsupported.
func (*Store) Labels ¶
Labels enumerates label names (sel.Name=="") or the values of a named dimension via Loki's label API. Loki does not return occurrence counts, so LabelValue.Count stays 0.