func isGauge(a []int64) bool {
	// Check all the items in a, since a part of items may lead
	// to incorrect gauge detection.

	if len(a) < 2 {
		return false
	}

	extremes := 0
	plus := a[0] <= a[1]
	v1 := a[1]
	for _, v2 := range a[2:] {
		if plus {
			if v2 < v1 {
				extremes++
				plus = false
			}
		} else {
			if v2 > v1 {
				extremes++
				plus = true
			}
		}
		v1 = v2
	}
	if extremes <= 2 {
		// Probably counter reset.
		return false
	}

	// A few extremes may indicate counter resets.
	// Let it be a gauge if extremes exceed len(a)/32,
	// otherwise assume counter reset.
	return extremes > (len(a) >> 5)
}
// isGauge returns true if a contains gauge values,
// i.e. arbitrary changing values.
//
// It is OK if a few gauges aren't detected (i.e. detected as counters),
// since misdetected counters as gauges are much worse condition.
isGauge returns true if a contains gauge values,
i.e. arbitrary changing values.

It is OK if a few gauges aren't detected ,
since misdetected counters as gauges are much worse condition.
// isGauge returns true if a contains gauge values // i . e . arbitrary changing values . // // It is OK if a few gauges aren ' t detected ( i . e . detected as counters ) // since misdetected counters as gauges are much worse condition .
func isGauge(a []int64) bool {
	if len(a) < 2 {
		return false
	}
	extremes := 0
	plus := a[0] <= a[1]
	v1 := a[1]
	for _, v2 := range a[2:] {
		if plus {
			if v2 < v1 {
				extremes++
				plus = false
			}
		} else {
			if v2 > v1 {
				extremes++
				plus = true
			}
		}
		v1 = v2
	}
	if extremes <= 2 {
		return false
	}
	return extremes > (len(a) >> 5)
}
func isGauge ( a [ ] int64 ) bool { if len ( a ) < 2 { return false } extremes := 0 plus := a [ 0 ] <= a [ 1 ] v1 := a [ 1 ] for _ , v2 := range a [ 2 : ] { if plus { if v2 < v1 { extremes ++ plus = false } } else { if v2 > v1 { extremes ++ plus = true } } v1 = v2 } if extremes <= 2 { return false } return extremes > ( len ( a ) >> 5 ) }
isGauge returns true if a contains gauge values,
i.e.
isGauge returns true if a contains gauge values i . e .
// Check all the items in a, since a part of items may lead // to incorrect gauge detection. // Probably counter reset. // A few extremes may indicate counter resets. // Let it be a gauge if extremes exceed len(a)/32, // otherwise assume counter reset.