Documentation ¶
Index ¶
- Constants
- func CopyDir(src, dst string) error
- func CopyFile(src, dst string) error
- func CopyFileAll(src, dst string) error
- func EnsureParentDirsExist(p string) error
- func ExtractLastFragment(value string) string
- func Float64Ptr(v float64) *float64
- func Fqdn(hostname string) string
- func GetAgentNetworkMode(context.Context) (string, error)
- func GetAgentUTSMode(context.Context) (containers.UTSMode, error)
- func GetFileModTime(path string) (time.Time, error)
- func GetFileSize(path string) (int64, error)
- func GetGoRoutinesDump() (string, error)
- func GetHostname(ctx context.Context) (string, error)
- func GetJSONSerializableMap(m interface{}) interface{}
- func HTTPHeaders() map[string]string
- func InsertionSort(elements []string)
- func JSONString(c interface{}) string
- func LogVersionHistory()
- func SetupCoreDump() error
- func SortUniqInPlace(elements []string) []string
- func UInt64Ptr(v uint64) *uint64
- func UIntToFloatPtr(u uint64) *float64
- func Wait(d time.Duration)
- type BiMap
- func (b *BiMap) AddKV(k, v interface{}) error
- func (b *BiMap) GetKV(key interface{}) (interface{}, error)
- func (b *BiMap) GetKVBimap(key interface{}) (interface{}, error)
- func (b *BiMap) GetKVReverse(key interface{}) (interface{}, error)
- func (b *BiMap) Keys() []interface{}
- func (b *BiMap) Values() []interface{}
- type HostnameData
- type NamedPipe
- type PollingFunc
- type SlidingWindow
- type Stat
- type Stats
- type StatsTracker
- type StatsUpdateFunc
- type UnixNamedPipe
Constants ¶
const HostnameProviderConfiguration = "configuration"
HostnameProviderConfiguration is the key for the hostname provider associated to datadog.yaml
const InsertionSortThreshold = 40
InsertionSortThreshold is the slice size after which we should consider using the stdlib sort method instead of the InsertionSort implemented below.
Variables ¶
This section is empty.
Functions ¶
func CopyFileAll ¶
CopyFileAll calls CopyFile, but will create necessary directories for `dst`.
func EnsureParentDirsExist ¶
EnsureParentDirsExist makes a path immediately available for writing by creating the necessary parent directories.
func ExtractLastFragment ¶
ExtractLastFragment extracts the last fragment of a path
func Float64Ptr ¶
Float64Ptr returns a pointer from a value. It will allocate a new heap object for it.
func GetAgentNetworkMode ¶
GetAgentNetworkMode retrieves from Docker the network mode of the Agent container
func GetAgentUTSMode ¶
func GetAgentUTSMode(context.Context) (containers.UTSMode, error)
GetAgentUTSMode retrieves from Docker the UTS mode of the Agent container
func GetFileModTime ¶
GetFileModTime gets the modification time
func GetGoRoutinesDump ¶
GetGoRoutinesDump returns the stack trace of every Go routine of a running Agent.
func GetHostname ¶
GetHostname retrieves the host name from GetHostnameData
func GetJSONSerializableMap ¶
func GetJSONSerializableMap(m interface{}) interface{}
GetJSONSerializableMap returns a JSON serializable map from a raw map
func HTTPHeaders ¶
HTTPHeaders returns a http headers including various basic information (User-Agent, Content-Type...).
func InsertionSort ¶
func InsertionSort(elements []string)
InsertionSort sorts in-place the given elements, not doing any allocation. It is very efficient for on slices but if memory allocation is not an issue, consider using the stdlib `sort.Sort` method on slices having a size > InsertionSortThreshold. See `pkg/util/sort_benchmarks_note.md` for more details.
func JSONString ¶
func JSONString(c interface{}) string
JSONString encodes input into JSON while also encoding an error - for logging purpose
func LogVersionHistory ¶
func LogVersionHistory()
LogVersionHistory loads version history file, append new entry if agent version is different than the last entry in the JSON file, trim the file if too many entries then save the file.
func SetupCoreDump ¶
func SetupCoreDump() error
SetupCoreDump enables core dumps and sets the core dump size limit based on configuration
func SortUniqInPlace ¶
SortUniqInPlace sorts and remove duplicates from elements in place The returned slice is a subslice of elements
func UInt64Ptr ¶
UInt64Ptr returns a pointer from a value. It will allocate a new heap object for it.
func UIntToFloatPtr ¶
UIntToFloatPtr converts a uint64 value to float64 and returns a pointer.
Types ¶
type BiMap ¶
type BiMap struct {
// contains filtered or unexported fields
}
BiMap provides a bidirectional map of keys and values.
func (*BiMap) GetKVBimap ¶
GetKVBimap looks for the provided key both for keys and values in the map.
The first occurrence will be returned.
func (*BiMap) GetKVReverse ¶
GetKVReverse gets key provided the value.
type HostnameData ¶
HostnameData contains hostname and the hostname provider
func GetHostnameData ¶
func GetHostnameData(ctx context.Context) (HostnameData, error)
GetHostnameData retrieves the host name for the Agent and hostname provider, trying to query these environments/api, in order: * Config (`hostname') * Config (`hostname_file') * GCE * Docker * kubernetes * os * EC2
type NamedPipe ¶
type NamedPipe interface { Open() error Ready() bool Read(b []byte) (int, error) Write(b []byte) (int, error) Close() error }
NamedPipe interface to NamedPipes (multi-platform)
type PollingFunc ¶
type PollingFunc func() (value float64)
PollingFunc is polled at specified intervals to collect the value that should be included in the slidingWindow data
type SlidingWindow ¶
type SlidingWindow interface { // Start validates the parameters of a SlidingWindow object and starts the // ticker. Start can only be invoked once on an instance. Start(PollingFunc, StatsUpdateFunc) error // Stop stops the polling and processing of the data. Stop() // Average returns an average of all the polled values collected so far over // the sliding window range. Average() float64 // WindowSize returns the amount of time that the SlidingWindow will keep // the polled values before evicting them. WindowSize() time.Duration }
SlidingWindow is the public API that we expose from the slidingWindow object
func NewSlidingWindow ¶
func NewSlidingWindow(windowSize time.Duration, pollingInterval time.Duration) (SlidingWindow, error)
NewSlidingWindow creates a new instance of a slidingWindow
func NewSlidingWindowWithClock ¶
func NewSlidingWindowWithClock(windowSize time.Duration, pollingInterval time.Duration, clock clock.Clock) (SlidingWindow, error)
NewSlidingWindowWithClock creates a new instance of a slidingWindow but with a custom clock implementation
type Stats ¶
type Stats struct { Aggregated chan Stat // contains filtered or unexported fields }
Stats type structure enabling statting facilities.
type StatsTracker ¶
type StatsTracker struct {
// contains filtered or unexported fields
}
StatsTracker Keeps track of simple stats over its lifetime and a configurable time range. StatsTracker is designed to be memory efficient by aggregating data into buckets. For example a time frame of 24 hours with a bucketFrame of 1 hour will ensure that only 24 points are ever kept in memory. New data is considered in the stats immediately while old data is removed by dropping expired aggregated buckets.
func NewStatsTracker ¶
func NewStatsTracker(timeFrame time.Duration, bucketSize time.Duration) *StatsTracker
NewStatsTracker Creates a new StatsTracker instance
func NewStatsTrackerWithTimeProvider ¶
func NewStatsTrackerWithTimeProvider(timeFrame time.Duration, bucketSize time.Duration, timeProvider timeProvider) *StatsTracker
NewStatsTrackerWithTimeProvider Creates a new StatsTracker instance with a time provider closure (mostly for testing)
func (*StatsTracker) Add ¶
func (s *StatsTracker) Add(value int64)
Add Records a new value to the stats tracker
func (*StatsTracker) AllTimeAvg ¶
func (s *StatsTracker) AllTimeAvg() int64
AllTimeAvg Gets the all time average of values seen so far
func (*StatsTracker) AllTimePeak ¶
func (s *StatsTracker) AllTimePeak() int64
AllTimePeak Gets the largest value seen so far
func (*StatsTracker) MovingAvg ¶
func (s *StatsTracker) MovingAvg() int64
MovingAvg Gets the moving average of values within the time frame
func (*StatsTracker) MovingPeak ¶
func (s *StatsTracker) MovingPeak() int64
MovingPeak Gets the largest value seen within the time frame
type StatsUpdateFunc ¶
type StatsUpdateFunc func(SlidingWindow)
StatsUpdateFunc is invoked when the polling function finishes collecting the data and the internal stats are updated.
type UnixNamedPipe ¶
type UnixNamedPipe struct {
// contains filtered or unexported fields
}
UnixNamedPipe unix abstraction to named pipes
func NewUnixNamedPipe ¶
func NewUnixNamedPipe(path string) (*UnixNamedPipe, error)
NewUnixNamedPipe UnixNamedPipe constructor
func (*UnixNamedPipe) Open ¶
func (p *UnixNamedPipe) Open() error
Open opens named pipe - will create it if doesn't exist
func (*UnixNamedPipe) Ready ¶
func (p *UnixNamedPipe) Ready() bool
Ready is the pipe ready to read/write?
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cachedfetch provides a read-through cache for fetched values.
|
Package cachedfetch provides a read-through cache for fetched values. |
providers/windows
Package windows We need a file in this package as it's referenced by a file built on windows
|
Package windows We need a file in this package as it's referenced by a file built on windows |
Package ecs provides metadata collection when the Agent runs on the ECS platform
|
Package ecs provides metadata collection when the Agent runs on the ECS platform |
metadata
Package metadata provides clients for Metadata APIs exposed by the ECS agent.
|
Package metadata provides clients for Metadata APIs exposed by the ECS agent. |
Package executable provides information on the executable that started the process and utils to find other executables on the system
|
Package executable provides information on the executable that started the process and utils to find other executables on the system |
validate
Package validate provides hostname validation helpers
|
Package validate provides hostname validation helpers |
log
module
|
|
scrubber
module
|
|
winutil
module
|
|