layout

package
v0.1.83 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 14 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"`
	// Flattened resolves canonical attributes no scalar field maps to one field
	// per key, such as the tag.<key> fields Jaeger's tags_as_fields writes.
	Flattened []FlattenedAttributes `json:"flattened,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) AttributeCondition added in v0.1.83

func (d Definition) AttributeCondition(key string, op esdsl.Operator, values ...string) (esdsl.Condition, error)

AttributeCondition is op on attribute key of a span or of its resource, in source fields: one clause per place the layout holds attributes.<key> or resource.<key>, any of which may match. OpExists takes no values, OpTerm and OpPrefix one, and OpTerms one or more. It fails when neither scope resolves, or when a value condition would land on a field that is not an exact keyword.

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, else the field a flattened rule names for it.

func (Definition) SourceTargets added in v0.1.83

func (d Definition) SourceTargets(canonical string) ([]Target, error)

SourceTargets is every place canonical is read, any of which may hold it: the scalar field the index maps, or else the field a flattened rule names, and the nested list entry keyed by the attribute name. An index holding both Jaeger tag shapes resolves an attribute to both.

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
	FlattenedOverrides []FlattenedAttributes
}

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"`
}

func (Field) TimeFieldFormat added in v0.1.83

func (f Field) TimeFieldFormat() esdsl.TimeFieldFormat

TimeFieldFormat is the epoch format a search bounding f declares: that of its Unit for a numeric field, and none for a date field, whose mapping already says how it stores instants.

type FlattenedAttributes added in v0.1.83

type FlattenedAttributes struct {
	Prefix      string `json:"prefix"`
	FieldPrefix string `json:"fieldPrefix"`
	Separator   string `json:"separator"`
}

FlattenedAttributes maps every canonical name under Prefix to one field: the rest of the name, its "." replaced by Separator, under FieldPrefix. Jaeger's tags_as_fields writes span tag http.method as tag.http@method.

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