otel

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const NoopConfig = `` /* 832-byte string literal not displayed */

NoopConfig returns a configuration to use that is essential a NOOP.

Variables

This section is empty.

Functions

func ParseComponentID

func ParseComponentID(id ComponentID) (pipelineType, name string)

ParseComponentID returns the typeName and name from a ComponentID

Types

type ComponentID

type ComponentID string

ComponentID is a the name of an individual receiver, processor, exporter, or extension.

func NewComponentID

func NewComponentID(pipelineType, name string) ComponentID

NewComponentID creates a new ComponentID from its type and name

func UniqueComponentID

func UniqueComponentID(original, typeName, resourceName string) ComponentID

UniqueComponentID ensures that each ComponentID is unique by including the type and resource name. To make them easy to find in a completed configuration, we preserve the part before the / and then insert the type and resource name separated by 2 underscores.

type ComponentIDProvider

type ComponentIDProvider interface {
	ComponentID(componentName string) ComponentID
}

ComponentIDProvider can provide ComponentIDs for component names

type ComponentList

type ComponentList []map[ComponentID]any

ComponentList is an ordered list of individual receivers, processors, etc. The order is especially important for processors.

type ComponentMap

type ComponentMap map[ComponentID]any

ComponentMap is a map of individual receivers, processors, etc.

type Configuration

type Configuration struct {
	Receivers  ComponentMap `yaml:"receivers,omitempty"`
	Processors ComponentMap `yaml:"processors,omitempty"`
	Exporters  ComponentMap `yaml:"exporters,omitempty"`
	Extensions ComponentMap `yaml:"extensions,omitempty"`
	Service    Service      `yaml:"service"`
}

Configuration is a rough approximation of an OpenTelemetry configuration. It is used to help assemble a configuration and marshal it to a string to send to an agent.

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration creates a new configuration with initialized fields

func (*Configuration) AddExtension

func (c *Configuration) AddExtension(name ComponentID, extension any)

AddExtension adds the specified extension with the specified id, replace any extension with the same id

func (*Configuration) AddExtensions

func (c *Configuration) AddExtensions(extensions ComponentList)

AddExtensions adds all of the extensions to the configuration, replacing any extensions with the same id

func (*Configuration) AddPipeline

func (c *Configuration) AddPipeline(name string, pipelineType PipelineType, source, destination Partials)

AddPipeline adds a pipeline and all of the corresponding components to the configuration

func (*Configuration) HasPipelines

func (c *Configuration) HasPipelines() bool

HasPipelines returns true if there are pipelines

func (*Configuration) YAML

func (c *Configuration) YAML() (string, error)

YAML marshals the configuration to yaml

type Partial

type Partial struct {
	Receivers  ComponentList
	Processors ComponentList
	Exporters  ComponentList
	Extensions ComponentList
}

Partial represents a fragment of configuration produced by an individual resource.

func (*Partial) Add

func (p *Partial) Add(o *Partial)

Add adds components from another partial by appending each of the component lists together

func (*Partial) Size

func (p *Partial) Size() int

Size returns the number of components in the partial configuration

type Partials

type Partials map[PipelineType]*Partial

Partials represents a fragments of configuration for each type of telemetry.

type Pipeline

type Pipeline struct {
	Name       string        `yaml:"-"`
	Receivers  []ComponentID `yaml:"receivers"`
	Processors []ComponentID `yaml:"processors"`
	Exporters  []ComponentID `yaml:"exporters"`
}

Pipeline is an ordered list of receivers, processors, and exporters.

func (*Pipeline) AddExporters

func (p *Pipeline) AddExporters(id []ComponentID)

AddExporters adds exporters to the pipeline

func (*Pipeline) AddProcessors

func (p *Pipeline) AddProcessors(id []ComponentID)

AddProcessors adds processors to the pipeline

func (*Pipeline) AddReceivers

func (p *Pipeline) AddReceivers(id []ComponentID)

AddReceivers adds receivers to the pipeline

func (*Pipeline) Incomplete

func (p *Pipeline) Incomplete() bool

Incomplete returns true if there are zero Receivers or zero Exporters

type PipelineType

type PipelineType string

PipelineType is the telemetry type specified in pipeline names, e.g. metrics in metrics/redis.

const (
	Metrics PipelineType = "metrics"
	Logs    PipelineType = "logs"
	Traces  PipelineType = "traces"
)

OpenTelemetry currently supports "metrics", "logs", and "traces"

type Pipelines

type Pipelines map[string]Pipeline

Pipelines are identified by a pipeline type and name in the form type/name where type is "metrics", "logs", or "traces"

type Service

type Service struct {
	Extensions []ComponentID `yaml:"extensions,omitempty"`
	Pipelines  Pipelines     `yaml:"pipelines"`
}

Service is the part of the configuration that defines the pipelines which consist of references to the components in the Configuration.

Jump to

Keyboard shortcuts

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