Documentation ¶
Index ¶
- Variables
- type ConfigProvider
- type ConfigurableOtelEbpfSdk
- type Director
- type DirectorKey
- type DirectorsMap
- type EbpfDirector
- func (d *EbpfDirector[T]) ApplyInstrumentationConfiguration(ctx context.Context, workload *workload.PodWorkload, ...) error
- func (d *EbpfDirector[T]) Cleanup(pod types.NamespacedName)
- func (d *EbpfDirector[T]) GetWorkloadInstrumentations(workload *workload.PodWorkload) []T
- func (d *EbpfDirector[T]) Instrument(ctx context.Context, pid int, pod types.NamespacedName, ...) error
- func (d *EbpfDirector[T]) Language() common.ProgrammingLanguage
- func (d *EbpfDirector[T]) ShouldInstrument(pid int, details []process.Details) bool
- func (d *EbpfDirector[T]) Shutdown()
- type InstrumentationFactory
- type InstrumentationStatusReason
- type InstrumentedProcess
- type OtelEbpfSdk
Constants ¶
This section is empty.
Variables ¶
var CleanupInterval = 30 * time.Second
CleanupInterval is the interval in which the director will check if the instrumented processes are still running and clean up the resources associated to the ones that are not. It is not const for testing purposes.
var IsProcessExists = func(pid int) bool { p, err := os.FindProcess(pid) if err != nil { return false } err = p.Signal(syscall.Signal(0)) if err == nil { return true } if errors.Is(err, os.ErrProcessDone) { return false } errno, ok := err.(syscall.Errno) if !ok { return false } if errno == syscall.EPERM { return true } return false }
defining this function here allows mocking it in tests
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶ added in v1.0.98
type ConfigProvider[C any] struct { // contains filtered or unexported fields }
func NewConfigProvider ¶ added in v1.0.98
func NewConfigProvider[C any](initialConfig C) *ConfigProvider[C]
NewConfigProvider creates a new configProvider with the given initial config. It allows for updating the configuration of a running instrumentation.
func (*ConfigProvider[C]) InitialConfig ¶ added in v1.0.98
func (c *ConfigProvider[C]) InitialConfig(_ context.Context) C
func (*ConfigProvider[C]) SendConfig ¶ added in v1.0.98
func (c *ConfigProvider[C]) SendConfig(ctx context.Context, newConfig C) error
SendConfig sends a new configuration to the instrumentation. If the instrumentation was closed or cannot accept the new configuration within a configured timeout, an error is returned.
func (*ConfigProvider[C]) Shutdown ¶ added in v1.0.98
func (c *ConfigProvider[C]) Shutdown(_ context.Context) error
func (*ConfigProvider[C]) Watch ¶ added in v1.0.98
func (c *ConfigProvider[C]) Watch() <-chan C
type ConfigurableOtelEbpfSdk ¶ added in v1.0.98
type ConfigurableOtelEbpfSdk interface { OtelEbpfSdk ApplyConfig(ctx context.Context, config *odigosv1.InstrumentationConfig) error }
type Director ¶
type Director interface { Language() common.ProgrammingLanguage Instrument(ctx context.Context, pid int, podDetails types.NamespacedName, podWorkload *workload.PodWorkload, appName string, containerName string) error Cleanup(podDetails types.NamespacedName) Shutdown() // TODO: once all our implementation move to this function we can rename it to ApplyInstrumentationConfig, // currently that name is reserved for the old API until it is removed. ApplyInstrumentationConfiguration(ctx context.Context, workload *workload.PodWorkload, instrumentationConfig *odigosv1.InstrumentationConfig) error ShouldInstrument(pid int, details []process.Details) bool }
Director manages the instrumentation for a specific SDK in a specific language
type DirectorKey ¶
type DirectorKey struct { Language common.ProgrammingLanguage common.OtelSdk }
type DirectorsMap ¶
type DirectorsMap map[DirectorKey]Director
type EbpfDirector ¶
type EbpfDirector[T OtelEbpfSdk] struct { // contains filtered or unexported fields }
func NewEbpfDirector ¶
func NewEbpfDirector[T OtelEbpfSdk](ctx context.Context, client client.Client, scheme *runtime.Scheme, language common.ProgrammingLanguage, instrumentationFactory InstrumentationFactory[T]) *EbpfDirector[T]
func (*EbpfDirector[T]) ApplyInstrumentationConfiguration ¶ added in v1.0.98
func (d *EbpfDirector[T]) ApplyInstrumentationConfiguration(ctx context.Context, workload *workload.PodWorkload, instrumentationConfig *odigosv1.InstrumentationConfig) error
func (*EbpfDirector[T]) Cleanup ¶
func (d *EbpfDirector[T]) Cleanup(pod types.NamespacedName)
Cleanup cleans up the resources associated with the given pod including all the instrumented processes.
func (*EbpfDirector[T]) GetWorkloadInstrumentations ¶
func (d *EbpfDirector[T]) GetWorkloadInstrumentations(workload *workload.PodWorkload) []T
func (*EbpfDirector[T]) Instrument ¶
func (d *EbpfDirector[T]) Instrument(ctx context.Context, pid int, pod types.NamespacedName, podWorkload *workload.PodWorkload, appName string, containerName string) error
func (*EbpfDirector[T]) Language ¶
func (d *EbpfDirector[T]) Language() common.ProgrammingLanguage
func (*EbpfDirector[T]) ShouldInstrument ¶ added in v1.0.105
func (d *EbpfDirector[T]) ShouldInstrument(pid int, details []process.Details) bool
func (*EbpfDirector[T]) Shutdown ¶
func (d *EbpfDirector[T]) Shutdown()
type InstrumentationFactory ¶
type InstrumentationFactory[T OtelEbpfSdk] interface { CreateEbpfInstrumentation(ctx context.Context, pid int, serviceName string, podWorkload *workload.PodWorkload, containerName string, podName string, loadedIndicator chan struct{}) (T, error) }
users can use different eBPF otel SDKs by returning them from this function
type InstrumentationStatusReason ¶ added in v1.0.64
type InstrumentationStatusReason string
const ( FailedToLoad InstrumentationStatusReason = "FailedToLoad" FailedToInitialize InstrumentationStatusReason = "FailedToInitialize" LoadedSuccessfully InstrumentationStatusReason = "LoadedSuccessfully" )
type InstrumentedProcess ¶ added in v1.0.108
type InstrumentedProcess[T OtelEbpfSdk] struct { PID int // contains filtered or unexported fields }
type OtelEbpfSdk ¶
type OtelEbpfSdk interface { // Run starts the eBPF instrumentation. // It should block until the instrumentation is stopped or the context is canceled or an error occurs. Run(ctx context.Context) error // Close cleans up the resources associated with the eBPF instrumentation. Close(ctx context.Context) error }
This interface should be implemented by all ebpf sdks for example, the go auto instrumentation sdk implements it