layout

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Fields map[string]Field `json:"fields"`
	// Nested resolves canonical attributes no scalar field maps, from a key/value
	// list such as Jaeger's nested `tags`, whose entries are never flattened.
	Nested []NestedAttributes `json:"nested,omitempty"`
}

func Discover

func Discover(options Discovery) (Definition, error)

Discover resolves a layout from the selected index's mapped fields, never its name.

func (Definition) CanonicalValue

func (d Definition) CanonicalValue(canonical string, value any) (any, error)

func (Definition) Normalize

func (d Definition) Normalize(row map[string]any) (span.Span, error)

func (Definition) SourceField

func (d Definition) SourceField(canonical string) (string, error)

SourceField is the scalar source field of canonical. An attribute only a nested list holds has none; read it through SourceTarget.

func (Definition) SourceTarget

func (d Definition) SourceTarget(canonical string) (Target, error)

SourceTarget is where canonical is read: its scalar field when the index maps one, else the value of the nested list entry keyed by the attribute name.

func (Definition) Translate

func (d Definition) Translate(body []byte, direction Direction) ([]byte, error)

func (Definition) TranslateSearch

func (d Definition) TranslateSearch(search esdsl.Search, direction Direction) (esdsl.Search, error)

type Direction

type Direction string
const (
	ToSource    Direction = "source"
	ToCanonical Direction = "canonical"
)

type Discovery

type Discovery struct {
	Fields map[string]string
	// Nested holds the leaves of nested containers, keyed by full field name.
	Nested          map[string]NestedLeaf
	Overrides       map[string]Field
	NestedOverrides []NestedAttributes
}

type Field

type Field struct {
	Source string         `json:"source"`
	Query  string         `json:"query,omitempty"`
	Type   string         `json:"type,omitempty"`
	Unit   string         `json:"unit,omitempty"`
	Format string         `json:"format,omitempty"`
	Values map[string]any `json:"values,omitempty"`
}

type NestedAttributes

type NestedAttributes struct {
	Prefix string `json:"prefix"`
	Path   string `json:"path"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

NestedAttributes maps every canonical name under Prefix to the Value of the entry of the nested list at Path whose Key equals the rest of the name.

type NestedLeaf

type NestedLeaf struct {
	Type      string
	Container string
}

NestedLeaf is a field mapped inside a nested container.

type Target

type Target struct {
	Field  string
	Nested string
	Where  map[string]string
}

Target is where a canonical field is read in the source index: a scalar Field, or Field inside the Nested list entry Where pins.

Jump to

Keyboard shortcuts

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