Documentation
¶
Overview ¶
Package apminject implements the apm injector installer
Index ¶
- type ApmSocketConfig
- type InjectorInstaller
- func (a *InjectorInstaller) Finish(err error)
- func (a *InjectorInstaller) Instrument(ctx context.Context) error
- func (a *InjectorInstaller) InstrumentLDPreload(ctx context.Context, via LDPreloadVia) (err error)
- func (a *InjectorInstaller) Remove(ctx context.Context) (err error)
- func (a *InjectorInstaller) Setup(ctx context.Context) error
- func (a *InjectorInstaller) Uninstrument(ctx context.Context) error
- func (a *InjectorInstaller) UninstrumentLDPreload(ctx context.Context) (err error)
- func (a *InjectorInstaller) UninstrumentLDPreloadTmpfs(ctx context.Context) (err error)
- type LDPreloadVia
- type SystemdServiceManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApmSocketConfig ¶
type ApmSocketConfig struct {
ReceiverSocket string `yaml:"receiver_socket"`
}
ApmSocketConfig is a subset of the agent configuration
type InjectorInstaller ¶
InjectorInstaller installs the APM injector
func NewInstaller ¶
func NewInstaller() *InjectorInstaller
NewInstaller returns a new APM injector installer
func (*InjectorInstaller) Finish ¶
func (a *InjectorInstaller) Finish(err error)
Finish cleans up the APM injector Runs rollbacks if an error is passed and always runs cleanups
func (*InjectorInstaller) Instrument ¶
func (a *InjectorInstaller) Instrument(ctx context.Context) error
Instrument instruments the APM injector
func (*InjectorInstaller) InstrumentLDPreload ¶ added in v0.80.0
func (a *InjectorInstaller) InstrumentLDPreload(ctx context.Context, via LDPreloadVia) (err error)
InstrumentLDPreload directly adds the injector library to /etc/ld.so.preload. It is also called by the systemd service via "datadog-installer apm instrument-start host" (with ViaTmpfsLink) and must not attempt to manage systemd (it would loop).
func (*InjectorInstaller) Remove ¶
func (a *InjectorInstaller) Remove(ctx context.Context) (err error)
Remove removes the APM injector
func (*InjectorInstaller) Setup ¶
func (a *InjectorInstaller) Setup(ctx context.Context) error
Setup sets up the APM injector
func (*InjectorInstaller) Uninstrument ¶
func (a *InjectorInstaller) Uninstrument(ctx context.Context) error
Uninstrument uninstruments the APM injector
func (*InjectorInstaller) UninstrumentLDPreload ¶ added in v0.80.0
func (a *InjectorInstaller) UninstrumentLDPreload(ctx context.Context) (err error)
UninstrumentLDPreload removes all launcher entries from /etc/ld.so.preload and the tmpfs symlink. Used by the full uninstrument flow (apm uninstrument).
func (*InjectorInstaller) UninstrumentLDPreloadTmpfs ¶ added in v0.81.2
func (a *InjectorInstaller) UninstrumentLDPreloadTmpfs(ctx context.Context) (err error)
UninstrumentLDPreloadTmpfs removes only the tmpfs launcher entry from /etc/ld.so.preload and the tmpfs symlink. Called by the datadog-apm-inject systemd service on stop (ExecStop). It intentionally leaves any persistent OCI entry untouched, making it safe to call on non-systemd hosts (where there is no tmpfs entry) and preventing it from accidentally removing persistent instrumentation.
type LDPreloadVia ¶ added in v0.81.2
type LDPreloadVia bool
LDPreloadVia selects how InstrumentLDPreload references the injector launcher in /etc/ld.so.preload.
const ( // ViaPersistentPath writes the launcher's persistent OCI path directly. It // survives reboots without the systemd service and is the fallback when the // service is unavailable or not running. ViaPersistentPath LDPreloadVia = false // ViaTmpfsLink writes the reboot-safe /run tmpfs symlink path. Referencing the // launcher through a /run symlink that the datadog-apm-inject service recreates // each boot means a stale ld.so.preload entry becomes inert after a reboot, so // the host stays usable even if shutdown-time cleanup did not run. Only valid on // systemd-managed hosts where the service repopulates /run. ViaTmpfsLink LDPreloadVia = true )
type SystemdServiceManager ¶ added in v0.80.0
type SystemdServiceManager struct {
// contains filtered or unexported fields
}
SystemdServiceManager manages the APM injector systemd service
func NewSystemdServiceManager ¶ added in v0.80.0
func NewSystemdServiceManager() *SystemdServiceManager
NewSystemdServiceManager builds a manager pointing at the first on-disk datadog-installer that supports the `apm instrument-start`/`instrument-stop` subcommands the unit invokes. The resolved path is baked into the unit's ExecStart/ExecStop. installerPath is "" when no supported installer is found (no candidate on disk, or only older ones); callers must then skip rendering the unit and fall back to direct ld.so.preload management (see setupSystemdPreloadUnit), since the candidate set is not guaranteed in practice.
func (*SystemdServiceManager) InstallerPath ¶ added in v0.80.2
func (s *SystemdServiceManager) InstallerPath() string
InstallerPath returns the supported datadog-installer path resolved at construction time, or "" if none was found.
func (*SystemdServiceManager) ServiceFileExists ¶ added in v0.81.2
func (s *SystemdServiceManager) ServiceFileExists() bool
ServiceFileExists reports whether the unit file has been written to disk.
func (*SystemdServiceManager) Setup ¶ added in v0.80.0
func (s *SystemdServiceManager) Setup(ctx context.Context) (err error)
Setup writes the embedded service file, enables it for future boots, and starts it immediately. Returns an error if any step fails, including the immediate start: a unit that cannot start is removed by the caller.