Documentation ¶
Overview ¶
Package otel provides functions for working with OTel pipelines
Index ¶
- Constants
- func ParseComponentID(id ComponentID) (pipelineType, name string)
- type ComponentID
- type ComponentIDProvider
- type ComponentList
- type ComponentMap
- type Configuration
- func (c *Configuration) AddAgentMetricsPipeline(rc *RenderContext)
- func (c *Configuration) AddExtension(name ComponentID, extension any)
- func (c *Configuration) AddExtensions(extensions ComponentList)
- func (c *Configuration) AddPipeline(name string, pipelineType PipelineType, sourceName string, source Partials, ...)
- func (c *Configuration) HasPipelines() bool
- func (c *Configuration) YAML() (string, error)
- type Partial
- type Partials
- type Pipeline
- func (p *Pipeline) AddExporters(_ *RenderContext, id []ComponentID)
- func (p *Pipeline) AddProcessors(rc *RenderContext, ids []ComponentID)
- func (p *Pipeline) AddReceivers(_ *RenderContext, id []ComponentID)
- func (p *Pipeline) ComponentID() ComponentID
- func (p *Pipeline) DestinationName() string
- func (p *Pipeline) Incomplete() bool
- func (p *Pipeline) SourceName() string
- func (p *Pipeline) Type() PipelineType
- type PipelineType
- type PipelineTypeFlags
- type Pipelines
- type RenderContext
- type Service
Constants ¶
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)
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() (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) Append ¶ added in v1.3.0
Append adds components from another partial by appending each of the component lists together
func (*Partial) HasNoReceiversOrExporters ¶ added in v1.3.0
HasNoReceiversOrExporters returns true if this Partial doesn't have any receivers or exporters
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
Append combines the individual Logs, Metrics, and Traces Partial configurations
func (Partials) Empty ¶ added in v1.3.0
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.
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
DestinationName returns the name of the Destination responsible for the exporters(s) of this pipeline.
func (*Pipeline) Incomplete ¶
Incomplete returns true if there are zero Receivers or zero Exporters
func (*Pipeline) SourceName ¶ added in v1.3.0
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 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) *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
AddPipeline adds a pipeline to the map of pipelines for the service