pitotql

package
v0.0.0-...-0301fe8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pitotql parses the text form of Pitot's structured telemetry queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCompleteRequest

func CheckCompleteRequest(req CompleteRequest) error

CheckCompleteRequest rejects a cursor outside the text and a window that is not a duration, so a client bug is a 400 rather than silent defaults.

func Reference

func Reference() string

Reference is the shared API, MCP resource and generated-site reference. Registry-owned names, field metadata and vocabularies are read on every call.

Types

type Compiled

type Compiled struct {
	Query      query.Spec
	Canonical  string
	Notices    []Notice
	Compatible []query.VizCompat
	Edits      []VizEdit
}

func Compile

func Compile(text string, opts Options) (*Compiled, query.Problems)

Compile parses, resolves and lowers text without executing SQL. A problem always prevents an executable query from being returned.

type CompleteRequest

type CompleteRequest struct {
	Options
	Text      string
	Cursor    int
	Window    string
	From, To  *time.Time
	Namespace string
}

type CompleteResponse

type CompleteResponse struct {
	Replace query.TextSpan `json:"replace"`
	Items   []Item         `json:"items"`
	Schema  SchemaStatus   `json:"schema"`
}

type Completer

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

func NewCompleter

func NewCompleter(source schemaSource) *Completer

func (*Completer) Complete

type Exactness

type Exactness string
const (
	Exact      Exactness = "exact"
	Normalized Exactness = "normalized"
)

type Failure

type Failure struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Failure is the transport-neutral PitotQL failure.

type Formatted

type Formatted struct {
	Requires  []Requirement `json:"requires"`
	Text      string        `json:"text"`
	Exactness Exactness     `json:"exactness"`
	Editable  bool          `json:"editable"`
	Reason    string        `json:"reason,omitempty"`
	Notices   []Notice      `json:"notices"`
	// Each stored filter and measure as PitotQL, in stored order, so an editor
	// can label entries it cannot edit without showing their SQL.
	Where    []string `json:"where"`
	Measures []string `json:"measures"`
}

func Format

func Format(ctx context.Context, p query.Parser, stored query.Spec, opts Options) (*Formatted, query.Problems, error)

Format preserves each stored filter as one entry. Candidates are kept only after a byte or engine-AST exactness check; all other filters remain raw.

type Item

type Item struct {
	Label  string `json:"label"`
	Insert string `json:"insert"`
	Kind   string `json:"kind"`
	Detail string `json:"detail"`
}

type Notice

type Notice struct {
	Path    string          `json:"path"`
	Message string          `json:"message"`
	Span    *query.TextSpan `json:"span,omitempty"`
	FixIts  []query.FixIt   `json:"fix_its,omitempty"`
}

type Options

type Options struct {
	Panel     *query.Panel     `json:"panel,omitempty"`
	Source    string           `json:"source,omitempty"`
	Viz       string           `json:"viz,omitempty"`
	Variables []query.Variable `json:"variables,omitempty"`
	Schema    *query.Schema    `json:"-"`
	// SchemaPartial says Schema may not cover the query's window or
	// namespace: notices may name a seen key but offer no fix.
	SchemaPartial bool `json:"-"`
}

type Requirement

type Requirement struct {
	Name      query.VizRequirement `json:"name"`
	Satisfied bool                 `json:"satisfied"`
}

type SchemaStatus

type SchemaStatus struct {
	Notice  string `json:"notice,omitempty"`
	Window  string `json:"window"`
	Sampled bool   `json:"sampled"`
	Warm    bool   `json:"warm"`
	Recent  bool   `json:"recent"`
	Error   bool   `json:"error,omitempty"`
}

type VizEdit

type VizEdit struct {
	Viz  string `json:"viz"`
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

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