scheduler

package
v0.36.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package scheduler exposes utilities for scheduling and running OpenTelemetry Collector components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

Host implements otelcomponent.Host for Grafana Agent Flow.

func NewHost

func NewHost(l log.Logger, opts ...HostOption) *Host

NewHost creates a new Host.

func (*Host) GetExporters

GetExporters implements otelcomponent.Host.

func (*Host) GetExtensions

func (h *Host) GetExtensions() map[otelcomponent.ID]otelextension.Extension

GetExtensions implements otelcomponent.Host.

func (*Host) GetFactory

func (h *Host) GetFactory(kind otelcomponent.Kind, componentType otelcomponent.Type) otelcomponent.Factory

GetFactory implements otelcomponent.Host.

func (*Host) ReportFatalError

func (h *Host) ReportFatalError(err error)

ReportFatalError implements otelcomponent.Host.

type HostOption

type HostOption func(*Host)

HostOption customizes behavior of the Host.

func WithHostExporters

func WithHostExporters(exporters map[otelcomponent.DataType]map[otelcomponent.ID]otelcomponent.Component) HostOption

WithHostExporters provides a custom set of exporters to the Host.

func WithHostExtensions

func WithHostExtensions(extensions map[otelcomponent.ID]otelextension.Extension) HostOption

WithHostExtensions provides a custom set of extensions to the Host.

type Scheduler

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

Scheduler implements manages a set of OpenTelemetry Collector components. Scheduler is intended to be used from Flow components which need to schedule OpenTelemetry Collector components; it does not implement the full component.Component interface.

Each OpenTelemetry Collector component has one instance per supported telemetry signal, which is why Scheduler supports multiple components. For example, when creating the otlpreceiver component, you would have three total instances: one for logs, one for metrics, and one for traces. Scheduler should only be used to manage the different signals of the same OpenTelemetry Collector component; this means that otlpreceiver and jaegerreceiver should not share the same Scheduler.

func New

func New(l log.Logger) *Scheduler

New creates a new unstarted Scheduler. Call Run to start it, and call Schedule to schedule components to run.

func (*Scheduler) CurrentHealth

func (cs *Scheduler) CurrentHealth() component.Health

CurrentHealth implements component.HealthComponent. The component is reported as healthy when the most recent set of scheduled components were started successfully.

func (*Scheduler) Run

func (cs *Scheduler) Run(ctx context.Context) error

Run starts the Scheduler. Run will watch for schedule components to appear and run them, terminating previously running components if they exist.

func (*Scheduler) Schedule

func (cs *Scheduler) Schedule(h otelcomponent.Host, cc ...otelcomponent.Component)

Schedule schedules a new set of OpenTelemetry Components to run. Components will only be scheduled when the Scheduler is running.

Schedule completely overrides the set of previously running components; components which have been removed since the last call to Schedule will be stopped.

Jump to

Keyboard shortcuts

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