Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CmpThreshold float64 = 0.2
CmpThreshold is the threshold for comparison of metrics used by the Proximal function.
Functions ¶
Types ¶
type Chunk ¶
Chunk represents a 'metric chunk' of data in the FTDC
func (*Chunk) Clip ¶
Clip trims the chunk to contain as little data as possible while keeping data within the given interval. If the chunk is entirely outside of the range, it is not modified and the return value is false.
type CmpScore ¶
type CmpScore struct { // Metric is the name of the metric being compared Metric string // Score is the value of the score, in the range [0, 1] Score float64 // Error stores an error message if the threshold was not met Err error }
CmpScore holds information for the comparison of a single metric.
type CmpScores ¶
type CmpScores []CmpScore
CmpScores implements sort.Interface for CmpScore slices
func Proximal ¶
Proximal computes a measure of deviation between two sets of metric statistics. It computes an aggregated score based on compareMetrics output, and compares it against the CmpThreshold.
Return values: score holds the numeric rating (1.0 = perfect), scores is the sorted list of scores for all compared metrics, and ok is whether the threshold was met.
type Metric ¶
type Metric struct { // Key is the dot-delimited key of the metric. The key is either // 'start', 'end', or starts with 'serverStatus.'. Key string // Value is the value of the metric at the beginning of the sample Value int // Deltas is the slice of deltas, which accumulate on Value to yield the // specific sample's value. Deltas []int }
Metric represents an item in a chunk.
type MetricStat ¶
type MetricStat struct { // Avg is the mean of the metric's deltas. It is analogous to the first // derivative. Avg int // Var is the variance. It is related to the absolute second derivative. Var int }
MetricStat represents basic statistics for a single metric
type Stats ¶
Stats represents basic statistics for a set of metric samples.
func ComputeStats ¶
ComputeAllChunkStats takes an FTDC diagnostic file in the form of an io.Reader, and computes statistics for all metrics on each chunk.
func ComputeStatsInterval ¶
ComputeStatsInterval takes an FTDC diagnostic file in the form of an io.Reader, and computes statistics for all metrics within the given time frame, clipping chunks to fit.
func MergeStats ¶
MergeStats computes a time-weighted merge of Stats.