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 (type 1).
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.
func (*Chunk) Expand ¶
Expand accumulates all deltas to give values of diagnostic data for each sample represented by the Chunk. includeKeys specifies which items should be included in the output. If a value of includeKeys is false, it won't be shown even if the value for a parent document is set to true. If includeKeys is nil, data for every key is returned.
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 DocType ¶
type DocType int32
DocType identifies the type of document in an FTDC file.
const ( // DocMetadata is a metadata document (type 0), collected on startup/rotation. DocMetadata DocType = 0 // DocMetricChunk is a compressed metric chunk (type 1), the primary data type. DocMetricChunk DocType = 1 // DocPeriodicMetadata is a periodic metadata document (type 2), new in MongoDB ~7.x. DocPeriodicMetadata DocType = 2 )
type Metric ¶
type Metric struct {
// Key is the dot-delimited key of the metric.
Key string
// Value is the value of the metric at the beginning of the sample.
Value int64
// Deltas is the slice of deltas, which accumulate on Value to yield the
// specific sample's value.
Deltas []int64
}
Metric represents an item in a chunk.
type MetricStat ¶
type MetricStat struct {
// Avg is the mean of the metric's deltas (first derivative).
Avg int64
// Var is the variance (related to the absolute second derivative).
Var int64
}
MetricStat represents basic statistics for a single metric
type Stats ¶
Stats represents basic statistics for a set of metric samples.
func ComputeStats ¶
ComputeStats 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.