Documentation
¶
Index ¶
- Constants
- Variables
- func FindAllProcesses(predicate func(int) bool) ([]int, error)
- func Group[K comparable](predicate func(int) (K, bool)) (map[K]map[int]struct{}, error)
- func HostProcDir() string
- func ProcFilePath(pid int, fileName string) string
- type Details
- type ProcessContext
- type ProcessEnvs
- type ProcessFile
Constants ¶
const ( NodeVersionConst = "NODE_VERSION" PythonVersionConst = "PYTHON_VERSION" JavaVersionConst = "JAVA_VERSION" JavaHomeConst = "JAVA_HOME" PhpVersionConst = "PHP_VERSION" RubyVersionConst = "RUBY_VERSION" )
const ( NewRelicAgentName = "New Relic Agent" DynatraceAgentName = "Dynatrace Agent" DataDogAgentName = "Datadog Agent" )
const ( NewRelicAgentEnv = "NEW_RELIC_CONFIG_FILE" DynatraceDynamizerEnv = "DT_DYNAMIZER_TARGET_EXE" DynatraceDynamizerExeSubString = "oneagentdynamizer" DynatraceFullStackEnvValuePrefix = "/dynatrace/" DataDogAgentEnv = "DD_TRACE_AGENT_URL" )
const (
// https://elixir.bootlin.com/linux/v6.5.5/source/include/uapi/linux/auxvec.h
AT_SECURE = 23
)
Variables ¶
var LangsVersionEnvs = map[string]struct{}{ NodeVersionConst: {}, PythonVersionConst: {}, JavaVersionConst: {}, JavaHomeConst: {}, PhpVersionConst: {}, RubyVersionConst: {}, }
LangsVersionEnvs is a map of environment variables used for detecting the versions of different languages
var OtherAgentCmdSubString = map[string]string{ "newrelic.jar": NewRelicAgentName, }
var OtherAgentEnvs = map[string]string{ NewRelicAgentEnv: NewRelicAgentName, DynatraceDynamizerEnv: DynatraceAgentName, DataDogAgentEnv: DataDogAgentName, }
Functions ¶
func FindAllProcesses ¶
Find all processes in the system. The function accepts a predicate function that can be used to filter the results.
func Group ¶ added in v1.14.0
func Group[K comparable](predicate func(int) (K, bool)) (map[K]map[int]struct{}, error)
Group processes by a key returned by the predicate function. The predicate function should return the key and a boolean indicating whether to include the process in the result. If the boolean is false, the process will be skipped. The function returns a map where the keys are the keys returned by the predicate function and the values are maps of process IDs that belong to each key.
func HostProcDir ¶ added in v1.2.1
func HostProcDir() string
func ProcFilePath ¶ added in v1.2.1
ProcFilePath constructs the file path for a given process ID and file name in the /proc filesystem.
Types ¶
type Details ¶
type Details struct {
ProcessID int
ExePath string
CmdLine string
Environments ProcessEnvs
SecureExecutionMode *bool
}
func GetPidDetails ¶
func (*Details) GetDetailedEnvsValue ¶ added in v1.0.93
type ProcessContext ¶ added in v1.0.165
type ProcessContext struct {
Details
// contains filtered or unexported fields
}
func NewProcessContext ¶ added in v1.0.165
func NewProcessContext(details Details) *ProcessContext
func (*ProcessContext) CloseFiles ¶ added in v1.0.165
func (pcx *ProcessContext) CloseFiles() error
Close method to close any open file handles.
func (*ProcessContext) GetExeFile ¶ added in v1.0.165
func (pcx *ProcessContext) GetExeFile() (ProcessFile, error)
func (*ProcessContext) GetMapsFile ¶ added in v1.0.165
func (pcx *ProcessContext) GetMapsFile() (ProcessFile, error)
type ProcessEnvs ¶ added in v1.0.93
type ProcessFile ¶ added in v1.0.165
type ProcessFile interface {
io.ReadSeekCloser
io.ReaderAt
}
ProcessFile is a read-only interface that supports reading, seeking, and reading at specific positions. Write operations should be avoided.