Documentation ¶
Overview ¶
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0 package acquire provides common functionality for the metrics acquisition
Index ¶
- Variables
- func CalculateSafeDelta(current, previous uint64, elapsedSecs float64) float64
- func CombinedOutputTimeout(c *exec.Cmd, timeout time.Duration) ([]byte, error)
- func ReadLines(filename string) ([]string, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) (ret []string, err error)
- func WaitTimeout(c *exec.Cmd, timeout time.Duration) error
- type Invoke
- type Invoker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Timeout = 3 * time.Second ErrTimeout = errors.New("Command timed out.") )
Functions ¶
func CalculateSafeDelta ¶
func CombinedOutputTimeout ¶
CombinedOutputTimeout runs the given command with the given timeout and returns the combined output of stdout and stderr. If the command times out, it attempts to kill the process.
func ReadLines ¶
ReadLines reads contents from a file and splits them by new lines. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).
func ReadLinesOffsetN ¶
ReadLines reads contents from file and splits them by new line. 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
Types ¶
Click to show internal directories.
Click to hide internal directories.