internal

package
v0.0.0-...-471a6d0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CollectorContribProcessorsVersion = "v0.143.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentType

type ComponentType string
const (
	ComponentTypeProcessor ComponentType = "processor"
)

type ConfigExample

type ConfigExample struct {
	Name    string `json:"name"`
	Signal  string `json:"signal"` // "logs", "traces", or "metrics"
	Config  string `json:"config"`
	Payload string `json:"payload"`
}

type Consumer

type Consumer[C any] interface {
	Observable
	// ComponentID returns the component.ID of the component.
	ComponentID() component.ID
	// ConsumeLogs processes the input logs and returns the transformed logs or an error.
	ConsumeLogs(config *C, input plog.Logs) (plog.Logs, error)
	// ConsumeMetrics processes the input metrics and returns the transformed metrics or an error.
	ConsumeMetrics(config *C, input pmetric.Metrics) (pmetric.Metrics, error)
	// ConsumeTraces processes the input traces and returns the transformed traces or an error.
	ConsumeTraces(config *C, input ptrace.Traces) (ptrace.Traces, error)
	// ConsumeProfiles processes the input profiles and returns the transformed profiles or an error.
	ConsumeProfiles(config *C, input pprofile.Profiles) (pprofile.Profiles, error)
	// CreateDefaultConfig returns the default configuration for the given component.
	CreateDefaultConfig() *C
	// TelemetrySettings returns the telemetry settings used by the component.
	TelemetrySettings() component.TelemetrySettings
}

type DebuggableExecutor

type DebuggableExecutor interface {
	Debugger() (Debugger, error)
}

DebuggableExecutor is an Executor that supports debugging.

type Debugger

type Debugger interface {
	Observable
	// DebugLogs evaluates log statements using the given configuration and JSON
	// payload with debugging enabled.
	DebugLogs(config, input string) (*Result, error)
	// DebugTraces is like DebugLogs, but for traces.
	DebugTraces(config, input string) (*Result, error)
	// DebugMetrics is like DebugLogs, but for metrics.
	DebugMetrics(config, input string) (*Result, error)
	// DebugProfiles is like DebugLogs, but for profiles.
	DebugProfiles(config, input string) (*Result, error)
}

Debugger provides debugging capabilities for OTTL statements.

func NewTransformProcessorDebugger

func NewTransformProcessorDebugger() Debugger

type Examples

type Examples struct {
	Configs  []ConfigExample  `json:"configs"`
	Payloads []PayloadExample `json:"payloads"`
}

type Executor

type Executor interface {
	Observable
	// ExecuteLogs evaluates log statements using the given configuration and JSON payload.
	// The returned value must be a valid plog.Logs JSON representing the input transformation.
	ExecuteLogs(config, input string) (*Result, error)
	// ExecuteTraces is like ExecuteLogs, but for traces.
	ExecuteTraces(config, input string) (*Result, error)
	// ExecuteMetrics is like ExecuteLogs, but for metrics.
	ExecuteMetrics(config, input string) (*Result, error)
	// ExecuteProfiles is like ExecuteLogs, but for profiles.
	ExecuteProfiles(config, input string) (*Result, error)
	// Metadata returns information about the executor
	Metadata() *Metadata
}

Executor evaluates OTTL statements using specific configurations and inputs.

func Executors

func Executors() []Executor

Executors returns a slice of all available executors.

func NewFilterProcessorExecutor

func NewFilterProcessorExecutor() Executor

NewFilterProcessorExecutor creates an internal.Executor that runs OTTL statements using the filterprocessor.

func NewJSONExecutor

func NewJSONExecutor[C any](
	consumer Consumer[C],
	metadata *Metadata,
	options ...executorOption[C],
) Executor

func NewTransformProcessorExecutor

func NewTransformProcessorExecutor() Executor

NewTransformProcessorExecutor creates an internal.Executor that runs OTTL statements using the transformprocessor.

type LoggedEntry

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

func (*LoggedEntry) ConsoleEncodedEntry

func (e *LoggedEntry) ConsoleEncodedEntry() string

type Metadata

type Metadata struct {
	Type             ComponentType                    `json:"type"`
	ID               string                           `json:"id"`
	Name             string                           `json:"name"`
	Path             string                           `json:"path"`
	Version          string                           `json:"version"`
	DocsURL          string                           `json:"docsURL"`
	ResultViewConfig map[ResultView]*ResultViewConfig `json:"resultViewConfig"`
	Examples         Examples                         `json:"examples"`
	Debuggable       bool                             `json:"debuggable"`
	OTTLEditorConfig OTTLEditorConfig                 `json:"ottlEditorConfig"`
}

Metadata contains information about the playground executor, such as its ID, name, path, version, documentation URL, and configuration for result views.

type OTTLEditorConfig

type OTTLEditorConfig struct {
	SyntaxHighlightPatterns []OTTLYamlPathPatterns `json:"syntaxHighlightPatterns"`
}

type OTTLGrammar

type OTTLGrammar string
const (
	OTTLGrammarAny       OTTLGrammar = "OTTL"
	OTTLGrammarCondition OTTLGrammar = "OTTLCondition"
	OTTLGrammarStatement OTTLGrammar = "OTTLStatement"
)

type OTTLYamlPathPatterns

type OTTLYamlPathPatterns struct {
	Grammar  OTTLGrammar `json:"grammar"`
	Patterns []string    `json:"patterns"`
}

type Observable

type Observable interface {
	// ObservedLogs returns the statements execution's logs
	ObservedLogs() *ObservedLogs
}

Observable represents an entity that can provide observed logs.

type ObservedLogs

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

func NewLogObserver

func NewLogObserver(level zapcore.LevelEnabler, config zapcore.EncoderConfig) (zapcore.Core, *ObservedLogs)

func (*ObservedLogs) All

func (o *ObservedLogs) All() []LoggedEntry

func (*ObservedLogs) Len

func (o *ObservedLogs) Len() int

func (*ObservedLogs) TakeAll

func (o *ObservedLogs) TakeAll() []LoggedEntry

func (*ObservedLogs) TakeAllString

func (o *ObservedLogs) TakeAllString() string

type PayloadExample

type PayloadExample struct {
	Name   string `json:"name"`
	Signal string `json:"signal"` // "logs", "traces", or "metrics"
	Value  string `json:"value"`
}

type Result

type Result struct {
	Value         string  `json:"value"`
	JSON          *string `json:"json,omitempty"`
	ExecutionTime int64   `json:"executionTime"`
	Error         string  `json:"error,omitempty"`
	Logs          string  `json:"logs"`
	Debug         bool    `json:"debug"`
	Line          int64   `json:"line"`
	// contains filtered or unexported fields
}

func NewErrorResult

func NewErrorResult(err string, logs string) *Result

func (*Result) AsRaw

func (r *Result) AsRaw() map[string]any

type ResultView

type ResultView string
const (
	ResultViewVisualDiff    ResultView = "visual_delta"
	ResultViewAnnotatedDiff ResultView = "annotated_delta"
	ResultViewJSON          ResultView = "json"
	ResultViewLogs          ResultView = "logs"
)

Keep this list in sync with the views defined in the frontend.

type ResultViewConfig

type ResultViewConfig struct {
	Enabled bool `json:"enabled"`
}

Jump to

Keyboard shortcuts

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