instrumentation

package
v0.19.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// InstrumentationLibraryConfigs defines library-specific configuration.
	// If a package is referenced by more than one key, the most specific key is used.
	// For example, if ("net/http", unspecified) and ("net/http", client) are both present,
	// the configuration for ("net/http", client) is used for client spans and the configuration for ("net/http", unspecified) is used for server spans.
	InstrumentationLibraryConfigs map[LibraryID]Library

	// DefaultTracesDisabled determines whether traces are disabled by default.
	// If set to true, traces are disabled by default for all libraries, unless the library is explicitly enabled.
	// If set to false, traces are enabled by default for all libraries, unless the library is explicitly disabled.
	// default is false - traces are enabled by default.
	DefaultTracesDisabled bool

	SamplingConfig *sampling.Config
}

Config is used to configure instrumentation.

type ConfigProvider

type ConfigProvider interface {
	// InitialConfig returns the initial instrumentation configuration.
	InitialConfig(ctx context.Context) Config
	// Watch returns a channel that receives updates to the instrumentation configuration.
	Watch() <-chan Config
	// Shutdown releases any resources held by the provider.
	// It is an error to send updates after Shutdown is called.
	Shutdown(ctx context.Context) error
}

ConfigProvider provides the initial configuration and updates to the instrumentation configuration.

func NewNoopConfigProvider

func NewNoopConfigProvider(sc *sampling.Config) ConfigProvider

NewNoopProvider returns a provider that does not provide any updates and provide the default configuration as the initial one.

type Library

type Library struct {
	// TracesEnabled determines whether traces are enabled for the instrumentation library.
	// if nil - take DefaultTracesDisabled value.
	TracesEnabled *bool
}

Library is used to configure instrumentation for a specific library.

type LibraryID

type LibraryID struct {
	// Name of the instrumentation pkg (e.g. "net/http").
	InstrumentedPkg string
	// SpanKind is the relevant span kind for the instrumentation.
	// This can be used to configure server-only, client-only spans.
	// If not set, the identifier is assumed to be applicable to all span kinds relevant to the instrumented package.
	SpanKind trace.SpanKind
}

LibraryID is used to identify an instrumentation library.

type Manager

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

Manager handles the management of probe.Probe instances.

func NewManager

func NewManager(logger *slog.Logger, otelController *opentelemetry.Controller, globalImpl bool, cp ConfigProvider, version string) (*Manager, error)

NewManager returns a new Manager.

func (*Manager) ConfigLoop

func (m *Manager) ConfigLoop(ctx context.Context)

func (*Manager) FilterUnusedProbes

func (m *Manager) FilterUnusedProbes(target *process.TargetDetails)

FilterUnusedProbes filterers probes whose functions are already instrumented out of the Manager.

func (*Manager) GetRelevantFuncs

func (m *Manager) GetRelevantFuncs() map[string]interface{}

GetRelevantFuncs returns the instrumented functions for all managed probes.

func (*Manager) Load

func (m *Manager) Load(ctx context.Context, target *process.TargetDetails) error

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

Run runs the event processing loop for all managed probes.

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops all probes and cleans up all the resources associated with them.

Directories

Path Synopsis
bpf
Package probe provides instrumentation probe types and definitions.
Package probe provides instrumentation probe types and definitions.

Jump to

Keyboard shortcuts

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