otel

package
v1.33.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package otel provides functions for working with OTel pipelines

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.

const MeasureProcessorName ComponentID = "throughputmeasurement"

MeasureProcessorName is the name of the measurement processor this is inserted into the pipeline to measure throughput

const SnapshotProcessorName ComponentID = "snapshotprocessor"

SnapshotProcessorName is the name of the snapshot processor that is inserted into each pipeline before the exporter

func NewComponentID

func NewComponentID(pipelineType, name string) ComponentID

NewComponentID creates a new ComponentID from its type and name

func UniqueComponentID

func UniqueComponentID(original, _, 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) AddAgentMetricsPipeline added in v1.3.0

func (c *Configuration) AddAgentMetricsPipeline(rc *RenderContext, headers map[string]string)

AddAgentMetricsPipeline adds the measurements pipeline to the configuration

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, sourceName string, source Partials, destinationName string, destination Partials, rc *RenderContext)

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(comment string) (string, error)

YAML marshals the configuration to yaml It prepends the comment string as a YAML comment, prepending each line of the comment with "#"

type MeasurementsTLS added in v1.13.0

type MeasurementsTLS struct {
	InsecureSkipVerify bool
	CertFile           *string
	KeyFile            *string
	CAFile             *string
}

MeasurementsTLS are the TLS setting for measurements reporting

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) Append added in v1.3.0

func (p *Partial) Append(o *Partial)

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

func (*Partial) HasNoReceiversOrExporters added in v1.3.0

func (p *Partial) HasNoReceiversOrExporters() bool

HasNoReceiversOrExporters returns true if this Partial doesn't have any receivers or exporters

func (*Partial) IsRoute added in v1.16.0

func (p *Partial) IsRoute() bool

IsRoute returns true if this partial contains the route receiver.

func (*Partial) Prepend added in v1.3.0

func (p *Partial) Prepend(o *Partial)

Prepend adds components from another partial by prepending 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.

func NewPartials added in v1.3.0

func NewPartials() Partials

NewPartials initializes a new Partials with empty Logs, Metrics, and Traces Partial configurations

func (Partials) Append added in v1.3.0

func (p Partials) Append(o Partials)

Append combines the individual Logs, Metrics, and Traces Partial configurations

func (Partials) Empty added in v1.3.0

func (p Partials) Empty() bool

Empty returns true if there are no components for any of the individual partial configurations for Logs, Metrics, and Traces

func (Partials) PipelineTypes added in v1.3.0

func (p Partials) PipelineTypes() PipelineTypeFlags

PipelineTypes returns the list of PipelineTypes with components in these Partials.

func (Partials) Prepend added in v1.3.0

func (p Partials) Prepend(o Partials)

Prepend combines the individual Logs, Metrics, and Traces Partial configurations

type Pipeline

type Pipeline struct {
	Receivers  []ComponentID `yaml:"receivers"`
	Processors []ComponentID `yaml:"processors"`
	Exporters  []ComponentID `yaml:"exporters"`
	// contains filtered or unexported fields
}

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

func NewPipeline added in v1.3.0

func NewPipeline(pipelineType PipelineType, name string, sourceName string, destinationName string) Pipeline

NewPipeline creates a new pipeline with the specified type

func (*Pipeline) AddExporters

func (p *Pipeline) AddExporters(_ *RenderContext, id []ComponentID)

AddExporters adds exporters to the pipeline

func (*Pipeline) AddProcessors

func (p *Pipeline) AddProcessors(rc *RenderContext, ids []ComponentID)

AddProcessors adds processors to the pipeline

func (*Pipeline) AddReceivers

func (p *Pipeline) AddReceivers(_ *RenderContext, id []ComponentID)

AddReceivers adds receivers to the pipeline

func (*Pipeline) ComponentID added in v1.3.0

func (p *Pipeline) ComponentID() ComponentID

ComponentID returns the ComponentID of the

func (*Pipeline) DestinationName added in v1.3.0

func (p *Pipeline) DestinationName() string

DestinationName returns the name of the Destination responsible for the exporters(s) of this pipeline.

func (*Pipeline) Incomplete

func (p *Pipeline) Incomplete() bool

Incomplete returns true if there are zero Receivers or zero Exporters

func (*Pipeline) SourceName added in v1.3.0

func (p *Pipeline) SourceName() string

SourceName returns the name of the Source responsible for the receiver(s) of this pipeline.

func (*Pipeline) Type added in v1.3.0

func (p *Pipeline) Type() PipelineType

Type returns the PipelineType of the pipeline

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"

func (PipelineType) Flag added in v1.3.0

func (pt PipelineType) Flag() PipelineTypeFlags

Flag returns the PipelineTypeFlags corresponding to this PipelineType

type PipelineTypeFlags added in v1.3.0

type PipelineTypeFlags byte

PipelineTypeFlags expresses a set of PipelineTypes

const (
	LogsFlag PipelineTypeFlags = 1 << iota
	MetricsFlag
	TracesFlag
)

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

func (PipelineTypeFlags) Includes added in v1.3.0

func (p PipelineTypeFlags) Includes(flags PipelineTypeFlags) bool

Includes returns true if the specified flags are included

func (PipelineTypeFlags) IncludesType added in v1.3.0

func (p PipelineTypeFlags) IncludesType(pipelineType PipelineType) bool

IncludesType returns true if the specified type is included

func (*PipelineTypeFlags) Set added in v1.3.0

func (p *PipelineTypeFlags) Set(flags PipelineTypeFlags)

Set will return a new PipelineTypeFlags including the specified flags

type Pipelines

type Pipelines map[ComponentID]Pipeline

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

type RenderContext added in v1.3.0

type RenderContext struct {
	IncludeSnapshotProcessor    bool
	IncludeMeasurements         bool
	IncludeRouteReceiver        bool
	AgentID                     string
	TLS                         *MeasurementsTLS
	ConfigurationName           string
	BindPlaneURL                string
	BindPlaneInsecureSkipVerify bool
	// contains filtered or unexported fields
}

RenderContext keeps track of state needed to render configurations

func NewRenderContext added in v1.3.0

func NewRenderContext(agentID string, configurationName string, bindplaneURL string, bindplaneInsecureSkipVerify bool, tls *MeasurementsTLS, measurementInterval string) *RenderContext

NewRenderContext creates a new render context used to render configurations

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.

func (*Service) AddPipeline added in v1.3.0

func (s *Service) AddPipeline(p Pipeline)

AddPipeline adds a pipeline to the map of pipelines for the service

Jump to

Keyboard shortcuts

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