span

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package span provides an otelcol.processor.span component.

Index

Constants

This section is empty.

Variables

View Source
var (
	StatusCodeOk    = ptrace.StatusCodeOk.String()
	StatusCodeError = ptrace.StatusCodeError.String()
	StatusCodeUnset = ptrace.StatusCodeUnset.String()
)
View Source
var DefaultToAttributes = ToAttributes{
	BreakAfterMatch: false,
}

DefaultArguments holds default settings for Arguments.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	Match otelcol.MatchConfig `alloy:",squash"`

	// Name specifies the components required to re-name a span.
	Name Name `alloy:"name,block,optional"`

	// SetStatus specifies status which should be set for this span.
	SetStatus *Status `alloy:"status,block,optional"`

	// Output configures where to send processed data. Required.
	Output *otelcol.ConsumerArguments `alloy:"output,block"`
}

Arguments configures the otelcol.processor.span component.

func (Arguments) Convert

func (args Arguments) Convert() (otelcomponent.Config, error)

Convert implements processor.Arguments.

func (Arguments) Exporters

Exporters implements processor.Arguments.

func (Arguments) Extensions

func (args Arguments) Extensions() map[otelcomponent.ID]otelextension.Extension

Extensions implements processor.Arguments.

func (Arguments) NextConsumers

func (args Arguments) NextConsumers() *otelcol.ConsumerArguments

NextConsumers implements processor.Arguments.

func (*Arguments) Validate

func (args *Arguments) Validate() error

Validate implements syntax.Validator.

type Name

type Name struct {

	// FromAttributes represents the attribute keys to pull the values from to
	// generate the new span name. All attribute keys are required in the span
	// to re-name a span. If any attribute is missing from the span, no re-name
	// will occur.
	// Note: The new span name is constructed in order of the `from_attributes`
	// specified in the configuration. This field is required and cannot be empty.
	FromAttributes []string `alloy:"from_attributes,attr,optional"`

	// Separator is the string used to separate attributes values in the new
	// span name. If no value is set, no separator is used between attribute
	// values. Used with FromAttributes only.
	Separator string `alloy:"separator,attr,optional"`

	// ToAttributes specifies a configuration to extract attributes from span name.
	ToAttributes *ToAttributes `alloy:"to_attributes,block,optional"`
}

Name specifies the attributes to use to re-name a span.

func (*Name) Convert

func (n *Name) Convert() *spanprocessor.Name

type Status

type Status struct {
	// Code is one of three values "Ok" or "Error" or "Unset". Please check:
	// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status
	Code string `alloy:"code,attr"`

	// Description is an optional field documenting Error statuses.
	Description string `alloy:"description,attr,optional"`
}

func (*Status) Convert

func (s *Status) Convert() *spanprocessor.Status

type ToAttributes

type ToAttributes struct {
	// Rules is a list of rules to extract attribute values from span name. The values
	// in the span name are replaced by extracted attribute names. Each rule in the list
	// is a regex pattern string. Span name is checked against the regex. If it matches
	// then all named subexpressions of the regex are extracted as attributes
	// and are added to the span. Each subexpression name becomes an attribute name and
	// subexpression matched portion becomes the attribute value. The matched portion
	// in the span name is replaced by extracted attribute name. If the attributes
	// already exist in the span then they will be overwritten. The process is repeated
	// for all rules in the order they are specified. Each subsequent rule works on the
	// span name that is the output after processing the previous rule.
	Rules []string `alloy:"rules,attr"`

	// BreakAfterMatch specifies if processing of rules should stop after the first
	// match. If it is false rule processing will continue to be performed over the
	// modified span name.
	BreakAfterMatch bool `alloy:"break_after_match,attr,optional"`
}

ToAttributes specifies a configuration to extract attributes from span name.

func (*ToAttributes) Convert

func (ta *ToAttributes) Convert() *spanprocessor.ToAttributes

func (*ToAttributes) SetToDefault

func (args *ToAttributes) SetToDefault()

SetToDefault implements syntax.Defaulter.

Jump to

Keyboard shortcuts

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