extension

package module
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 121

README

General Information

Extensions provide capabilities on top of the primary functionality of the collector. Generally, extensions are used for implementing components that can be added to the Collector, but which do not require direct access to telemetry data and are not part of the pipelines (like receivers, processors or exporters). Example extensions are: Health Check extension that responds to health check requests or PProf extension that allows fetching Collector's performance profile.

Supported service extensions (sorted alphabetically):

The contributors repository may have more extensions that can be added to custom builds of the Collector.

Ordering Extensions

The order extensions are specified for the service is important as this is the order in which each extension will be started and the reverse order in which they will be shutdown. The ordering is determined in the extensions tag under the service tag in the configuration file, example:

service:
  # Extensions specified below are going to be loaded by the service in the
  # order given below, and shutdown on reverse order.
  extensions: [memory_ballast, zpages]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFactoryMap

func MakeFactoryMap(factories ...Factory) (map[component.Type]Factory, error)

MakeFactoryMap takes a list of factories and returns a map with Factory type as keys. It returns a non-nil error when there are factories with duplicate type.

Types

type Builder

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

Builder extension is a helper struct that given a set of Configs and Factories helps with creating extensions.

func NewBuilder

func NewBuilder(cfgs map[component.ID]component.Config, factories map[component.Type]Factory) *Builder

NewBuilder creates a new extension.Builder to help with creating components form a set of configs and factories.

func (*Builder) Create

func (b *Builder) Create(ctx context.Context, set CreateSettings) (Extension, error)

Create creates an extension based on the settings and configs available.

func (*Builder) Factory

func (b *Builder) Factory(componentType component.Type) component.Factory

type ConfigWatcher added in v0.83.0

type ConfigWatcher interface {
	// NotifyConfig notifies the extension of the Collector's current effective configuration.
	// The extension owns the `confmap.Conf`. Callers must ensure that it's safe for
	// extensions to store the `conf` pointer and use it concurrently with any other
	// instances of `conf`.
	NotifyConfig(ctx context.Context, conf *confmap.Conf) error
}

ConfigWatcher is an interface that should be implemented by an extension that wishes to be notified of the Collector's effective configuration.

type CreateFunc

CreateFunc is the equivalent of Factory.Create(...) function.

func (CreateFunc) CreateExtension

func (f CreateFunc) CreateExtension(ctx context.Context, set CreateSettings, cfg component.Config) (Extension, error)

CreateExtension implements Factory.Create.

type CreateSettings

type CreateSettings struct {
	// ID returns the ID of the component that will be created.
	ID component.ID

	component.TelemetrySettings

	// BuildInfo can be used by components for informational purposes
	BuildInfo component.BuildInfo
}

CreateSettings is passed to Factory.Create(...) function.

type Dependent added in v0.89.0

type Dependent interface {
	Extension
	Dependencies() []component.ID
}

Dependent is an optional interface that can be implemented by extensions that depend on other extensions and must be started only after their dependencies. See https://github.com/open-telemetry/opentelemetry-collector/pull/8768 for examples.

type Extension

type Extension = component.Component

Extension is the interface for objects hosted by the OpenTelemetry Collector that don't participate directly on data pipelines but provide some functionality to the service, examples: health check endpoint, z-pages, etc.

type Factory

type Factory interface {
	component.Factory

	// CreateExtension creates an extension based on the given config.
	CreateExtension(ctx context.Context, set CreateSettings, cfg component.Config) (Extension, error)

	// ExtensionStability gets the stability level of the Extension.
	ExtensionStability() component.StabilityLevel
	// contains filtered or unexported methods
}

func NewFactory

func NewFactory(
	cfgType component.Type,
	createDefaultConfig component.CreateDefaultConfigFunc,
	createServiceExtension CreateFunc,
	sl component.StabilityLevel) Factory

NewFactory returns a new Factory based on this configuration.

type PipelineWatcher

type PipelineWatcher interface {
	// Ready notifies the Extension that all pipelines were built and the
	// receivers were started, i.e.: the service is ready to receive data
	// (note that it may already have received data when this method is called).
	Ready() error

	// NotReady notifies the Extension that all receivers are about to be stopped,
	// i.e.: pipeline receivers will not accept new data.
	// This is sent before receivers are stopped, so the Extension can take any
	// appropriate actions before that happens.
	NotReady() error
}

PipelineWatcher is an extra interface for Extension hosted by the OpenTelemetry Collector that is to be implemented by extensions interested in changes to pipeline states. Typically this will be used by extensions that change their behavior if data is being ingested or not, e.g.: a k8s readiness probe.

type StatusWatcher added in v0.87.0

type StatusWatcher interface {
	// ComponentStatusChanged notifies about a change in the source component status.
	// Extensions that implement this interface must be ready that the ComponentStatusChanged
	// may be called before, after or concurrently with calls to Component.Start() and Component.Shutdown().
	// The function may be called concurrently with itself.
	ComponentStatusChanged(source *component.InstanceID, event *component.StatusEvent)
}

StatusWatcher is an extra interface for Extension hosted by the OpenTelemetry Collector that is to be implemented by extensions interested in changes to component status.

Directories

Path Synopsis
auth module
experimental
storage
Package storage implements an extension that can persist state beyond the collector process.
Package storage implements an extension that can persist state beyond the collector process.

Jump to

Keyboard shortcuts

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