service

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Logger     *zap.Logger
	Generators []any
	Output     output.Output
	// contains filtered or unexported fields
}

Service manages generators and an output. It delegates orchestration of migrated ProducerModule generators to internal/runtime.Runtime and keeps the type-switch dispatch only for legacy generators that still use the writer-based Start signature (winevt, hostmetrics, traces).

func New

func New(logger *zap.Logger, generators []any, output output.Output) (*Service, error)

New creates a new service with multiple generators and a single output.

func (*Service) Start

func (s *Service) Start() error

Start starts all generators. ProducerModules run through Runtime; legacy metric/trace/log generators dispatch via writer interfaces.

If any legacy generator's Start fails (or the type switch hits the default case), Start rolls back: legacy generators already started are stopped in reverse order, then the Runtime is stopped, then the original error is returned. This prevents goroutine/worker leaks when Start aborts midway. Note that legacy generators' Stop methods use close(stopCh) under the hood, which panics on a second close — callers must NOT call Service.Stop after Service.Start returned an error; the rollback already cleaned up.

func (*Service) Stop

func (s *Service) Stop() error

Stop stops all generators and the output. Stop will block for up to 30 seconds.

Jump to

Keyboard shortcuts

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