Documentation ¶
Index ¶
- Variables
- func CustomRootCertPool() (*x509.CertPool, error)
- func FloatToIntRoundUP(f float64) int
- func GetEnv(key string, dfault string, combineWith ...string) string
- func HostProc(combineWith ...string) string
- func HostSys(combineWith ...string) string
- func LogOncef(logLevel logrus.Level, format string, args ...interface{})
- func MergeStringMaps(mapA, mapB map[string]interface{}) map[string]interface{}
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func RoundToTwoDecimalPlaces(v float64) float64
- func RunCommandInBackground(name string, arg ...string) ([]byte, error)
- func RunCommandWithContext(ctx context.Context, name string, arg ...string) ([]byte, error)
- func RunCommandWithTimeout(timeout time.Duration, name string, arg ...string) ([]byte, error)
- func StrInSlice(search string, slice []string) bool
- type ErrorCollector
- type Invoke
- type Invoker
- type MeasurementsMap
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
var ErrCommandExecutionTimeout = errors.New("command execution timeout exceeded")
var ErrorCustomRootCertPoolNotImplementedForOS = fmt.Errorf("not implemented for current os")
Functions ¶
func CustomRootCertPool ¶
func FloatToIntRoundUP ¶
func GetEnv ¶
GetEnv retrieves the environment variable key. If it does not exist it returns the default.
func LogOncef ¶
LogOncef logs message only once using standard logger hashes the serialized list of all parameters to check if message was already logged
func MergeStringMaps ¶
func ReadLines ¶
ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1). from github.com/shriou/gopsutil/internal/common.go
func ReadLinesOffsetN ¶
ReadLines reads contents from file and splits them by new line. from github.com/shriou/gopsutil/internal/common.go The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):
n >= 0: at most n lines n < 0: whole file
func RoundToTwoDecimalPlaces ¶
func RunCommandInBackground ¶
RunCommandInBackground convenience wrapper to RunCommandWithContext
func RunCommandWithContext ¶
RunCommandWithContext convenience wrapper to CommandWithContext
func RunCommandWithTimeout ¶
RunCommandWithTimeout runs command and returns it's standard output. If timeout exceeded the returned error is ErrCommandExecutionTimeout
func StrInSlice ¶
StrInSlice returns true if search string found in slice
Types ¶
type ErrorCollector ¶
type ErrorCollector struct {
// contains filtered or unexported fields
}
ErrorCollector type allows accumulation of errors in one place and operating on them as a single error.
func (*ErrorCollector) Add ¶
func (c *ErrorCollector) Add(err error)
Add adds error to collection if err is not nil
func (*ErrorCollector) Combine ¶
func (c *ErrorCollector) Combine() error
Combine returns all collected errors as a single error
func (*ErrorCollector) HasErrors ¶
func (c *ErrorCollector) HasErrors() bool
HasErrors returns true if there were any errors collected
func (*ErrorCollector) String ¶
func (c *ErrorCollector) String() string
String returns string representation of ErrorCollector (all errors concatenated)
type MeasurementsMap ¶
type MeasurementsMap map[string]interface{}
func (MeasurementsMap) AddInnerWithPrefix ¶
func (mm MeasurementsMap) AddInnerWithPrefix(prefix string, m MeasurementsMap) MeasurementsMap
func (MeasurementsMap) AddWithPrefix ¶
func (mm MeasurementsMap) AddWithPrefix(prefix string, m MeasurementsMap) MeasurementsMap