lang

package
v3.33.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DotnetInstrumentationEnvVars = []string{
	coreclrEnableProfilingEnvVar,
	"CORECLR_PROFILER",
	"CORECLR_PROFILER_PATH",
	"DOTNET_ADDITIONAL_DEPS",
	"DOTNET_SHARED_STORE",
	"DOTNET_STARTUP_HOOKS",
	"OTEL_DOTNET_AUTO_HOME",
}

DotnetInstrumentationEnvVars lists the environment variables whose presence indicates that a .NET process has profiling, startup hooks, an additional deps store, or OpenTelemetry .NET auto-instrumentation configured.

View Source
var JavaOptionsEnvVars = []string{
	"JAVA_TOOL_OPTIONS",
	"_JAVA_OPTIONS",
	"JDK_JAVA_OPTIONS",
	"IBM_JAVA_OPTIONS",
	"OPENJ9_JAVA_OPTIONS",
}

JavaOptionsEnvVars lists the environment variables the JVM consults for additional options, in the order we check them.

Functions

func HasDotnetInstrumentation

func HasDotnetInstrumentation(env map[string]string) bool

HasDotnetInstrumentation reports whether any of the well-known .NET instrumentation environment variables are set to a meaningful value. Values are trimmed of surrounding whitespace before evaluation; a var that trims to the empty string is treated as unset. CORECLR_ENABLE_PROFILING must additionally be exactly "1" to count as enabled (the CLR's own rule).

func HasNodeJSAutoInstrumentation

func HasNodeJSAutoInstrumentation(cmdline []string, env map[string]string) bool

HasNodeJSAutoInstrumentation reports whether the OpenTelemetry Node.js auto-instrumentation register hook is present, either as a "--require" flag on the process command line or inside the NODE_OPTIONS environment variable. Both "--require X" and "--require=X" forms are recognized.

Types

type JavaAgent

type JavaAgent struct {
	// Source is where the directive was found: "cmdline" or the env var name.
	Source string
	// Arg is the matched argument starting with "-javaagent:".
	Arg string
}

JavaAgent describes a -javaagent: directive found for a process.

func FindJavaAgent

func FindJavaAgent(cmdline []string, env map[string]string) *JavaAgent

FindJavaAgent scans process cmdline arguments and environment for a -javaagent: directive of the OpenTelemetry Java agent. We use contains of "opentelemetry-java" to support both Grafana's and OTel upstream agent naming. cmdline is the process argv (e.g. the result of splitting /proc/<pid>/cmdline on NUL). env is the process environment as a name->value map. cmdline takes precedence over env vars; env vars are checked in the order of JavaOptionsEnvVars. Returns nil if none found.

type PythonVersion

type PythonVersion struct {
	Major int
	Minor int
}

PythonVersion holds the major.minor version of a Python interpreter detected from a dynamically-linked libpython in a process's memory maps.

func DetectPythonVersion

func DetectPythonVersion(maps []*procfs.ProcMap) *PythonVersion

DetectPythonVersion scans process memory maps for a dynamically-linked libpython and returns its major.minor version. Returns nil if no qualifying libpython is found (e.g. the interpreter is statically linked, this is not a Python process, or only a version-less libpython.so symlink is mapped).

Jump to

Keyboard shortcuts

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