config

package
v0.0.0-...-3b12f0d Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BpfVerifierLogSetting

func BpfVerifierLogSetting() (level uint32, size int)

BpfVerifierLogSetting returns the eBPF verifier log settings.

func CacheDirectory

func CacheDirectory() string

CacheDirectory returns the cacheDirectory.

func CollectionAgentAddr

func CollectionAgentAddr() string

Collection agent address in host:port format

func ConfigurationFile

func ConfigurationFile() string

Path to profiling agent's configuration file

func DisableTLS

func DisableTLS() bool

Indicates if TLS to collection agent is disabled

func GenerateNewHostIDIfNecessary

func GenerateNewHostIDIfNecessary() error

GenerateHostID generates and sets the unique hostID

func HostID

func HostID() uint64

HostID returns the hostID of the running agent. The host ID is calculated by calling GenerateNewHostIDIfNecessary().

func Hostname

func Hostname() string

Hostname of the machine that is running the agent

func IPAddress

func IPAddress() string

IP address of the interface through which the agent traffic is routed

func KernelVersion

func KernelVersion() string

Kernel release (uname -r) of the machine that is running the agent

func MapScaleFactor

func MapScaleFactor() uint8

Scaling factor for eBPF maps

func MaxElementsPerInterval

func MaxElementsPerInterval() uint32

MaxElementsPerInterval returns the maximum of possible elements reported per interval based on the number of cores, samples per second and monitor interval.

func NoKernelVersionCheck

func NoKernelVersionCheck() bool

Indicates if kernel version checking for eBPF support is disabled

func PresentCPUCores

func PresentCPUCores() uint16

Number of CPU cores

func ProbabilisticThreshold

func ProbabilisticThreshold() uint

Threshold for probabilistic profiling

func ProjectID

func ProjectID() uint32

ProjectID returns the projectID

func RunsOnAWS

func RunsOnAWS() bool

RunsOnAWS returns true if host agent runs on AWS.

func RunsOnAzure

func RunsOnAzure() bool

RunsOnAzure returns true if host agent runs on Azure.

func RunsOnGCP

func RunsOnGCP() bool

RunsOnGCP returns true if host agent runs on GCP.

func SamplesPerSecond

func SamplesPerSecond() uint16

SamplesPerSecond returns the configured samples per second.

func SecretToken

func SecretToken() string

SecretToken returns the secretToken associated with the project

func SetConfiguration

func SetConfiguration(conf *Config) error

func StartTime

func StartTime() time.Time

HA start time

func Tags

func Tags() string

User-specified tags as passed-in by the user

func TraceCacheEntries

func TraceCacheEntries() uint32

TraceCacheEntries defines the maximum number of elements for the caches in tracehandler.

The caches in tracehandler have a size-"processing overhead" trade-off: Every cache miss will trigger additional processing for that trace in userspace (Go). For most maps, we use maxElementsPerInterval as a base sizing factor. For the tracehandler caches, we also multiply with traceCacheIntervals. For typical/small values of maxElementsPerInterval, this can lead to non-optimal map sizing (reduced cache_hit:cache_miss ratio and increased processing overhead). Simply increasing traceCacheIntervals is problematic when maxElementsPerInterval is large (e.g. too many CPU cores present) as we end up using too much memory. A minimum size is therefore used here. Also see: https://github.com/elastic/otel-profiling-agent/pull/2120#issuecomment-1043024813

func Tracers

func Tracers() string

User-specified tracers to enable

func UploadSymbols

func UploadSymbols() bool

Indicates whether automatic uploading of symbols is enabled

func ValidatedTags

func ValidatedTags() string

User-specified tags that have passed validation

func Verbose

func Verbose() bool

Verbose indicates if the agent is running with verbose enabled.

Types

type AzureInstanceMetadata

type AzureInstanceMetadata struct {
	Location       string `json:"location"`
	Name           string `json:"name"`
	SubscriptionID string `json:"subscriptionId"`
	Tags           string `json:"tags"`
	Version        string `json:"version"`
	VMID           string `json:"vmId"`
	Zone           string `json:"zone"`
}

AzureInstanceMetadata as provided by https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service It is needed to decode the json encoded return by Azure.

type Config

type Config struct {
	EnvironmentType        string
	MachineID              string
	SecretToken            string
	Tags                   string
	ValidatedTags          string
	CollectionAgentAddr    string
	ConfigurationFile      string
	Tracers                string
	CacheDirectory         string
	BpfVerifierLogSize     int
	BpfVerifierLogLevel    uint
	MonitorInterval        time.Duration
	TracePollInterval      time.Duration
	ReportInterval         time.Duration
	ProjectID              uint32
	SamplesPerSecond       uint16
	PresentCPUCores        uint16
	DisableTLS             bool
	UploadSymbols          bool
	NoKernelVersionCheck   bool
	TraceCacheIntervals    uint8
	Verbose                bool
	MapScaleFactor         uint8
	StartTime              time.Time
	ProbabilisticInterval  time.Duration
	ProbabilisticThreshold uint

	// Bits of hostmetadata that we save in config so that they can be
	// conveniently accessed globally in the agent.
	IPAddress     string
	Hostname      string
	KernelVersion string
}

Config is the structure to pass the configuration into host-agent.

type EnvironmentType

type EnvironmentType uint8

EnvironmentType indicates the environment, the agent is running on.

func (EnvironmentType) String

func (e EnvironmentType) String() string

type IntervalsAndTimers

type IntervalsAndTimers interface {
	// MonitorInterval defines the interval for PID event monitoring and metric collection.
	MonitorInterval() time.Duration
	// TracePollInterval defines the interval at which we read the trace perf event buffer.
	TracePollInterval() time.Duration
	// ReportInterval defines the interval at which collected data is sent to collection agent.
	ReportInterval() time.Duration
	// ReportMetricsInterval defines the interval at which collected metrics are sent
	// to collection agent.
	ReportMetricsInterval() time.Duration
	// GRPCConnectionTimeout defines the timeout for each established gRPC connection.
	GRPCConnectionTimeout() time.Duration
	// GRPCOperationTimeout defines the timeout for each gRPC operation.
	GRPCOperationTimeout() time.Duration
	// GRPCStartupBackoffTime defines the time between failed gRPC requests during startup
	// phase.
	GRPCStartupBackoffTime() time.Duration
	// GRPCAuthErrorDelay defines the delay before triggering a global process exit after a
	// gRPC auth error.
	GRPCAuthErrorDelay() time.Duration
	// PIDCleanupInterval defines the interval at which monitored PIDs are checked for
	// liveness and no longer alive PIDs are cleaned up.
	PIDCleanupInterval() time.Duration
	// ProbabilisticInterval defines the interval for which probabilistic profiling will
	// be enabled or disabled.
	ProbabilisticInterval() time.Duration
}

IntervalsAndTimers is a meta interface that exists purely to document its functionality.

type Times

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

Times hold all the intervals and timeouts that are used across the host agent in a central place and comes with Getters to read them.

func GetTimes

func GetTimes() *Times

GetTimes provides access to all timers and intervals.

func (*Times) GRPCAuthErrorDelay

func (t *Times) GRPCAuthErrorDelay() time.Duration

func (*Times) GRPCConnectionTimeout

func (t *Times) GRPCConnectionTimeout() time.Duration

func (*Times) GRPCOperationTimeout

func (t *Times) GRPCOperationTimeout() time.Duration

func (*Times) GRPCStartupBackoffTime

func (t *Times) GRPCStartupBackoffTime() time.Duration

func (*Times) MonitorInterval

func (t *Times) MonitorInterval() time.Duration

func (*Times) PIDCleanupInterval

func (t *Times) PIDCleanupInterval() time.Duration

func (*Times) ProbabilisticInterval

func (t *Times) ProbabilisticInterval() time.Duration

func (*Times) ReportInterval

func (t *Times) ReportInterval() time.Duration

func (*Times) ReportMetricsInterval

func (t *Times) ReportMetricsInterval() time.Duration

func (*Times) TracePollInterval

func (t *Times) TracePollInterval() time.Duration

type TracerType

type TracerType int

TracerType values identify tracers, such as the native code tracer, or PHP tracer

const (
	PerlTracer TracerType = iota
	PHPTracer
	PythonTracer
	HotspotTracer
	RubyTracer
	V8Tracer

	// MaxTracers indicates the max. number of different tracers
	MaxTracers
)

func AllTracers

func AllTracers() []TracerType

AllTracers returns a slice containing all supported tracers.

func (TracerType) GetString

func (t TracerType) GetString() string

GetString converts the tracer type t to its related string value.

Jump to

Keyboard shortcuts

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