Skip to content

Commit

Permalink
Merge pull request #81 from prometheus/beorn7/versioning
Browse files Browse the repository at this point in the history
Update vendoring of beorn7/perks.
  • Loading branch information
beorn7 committed Feb 23, 2015
2 parents 764e6a7 + 14c2f30 commit 3f532e7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion _vendor/perks/MANIFEST
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Imported at f15ca8fc2964cb9f291e1cf17bb1bf9a4f9e23d5 from https://github.com/beorn7/perks .
Imported at b965b613227fddccbfffe13eae360ed3fa822f8d from https://github.com/beorn7/perks .
21 changes: 15 additions & 6 deletions _vendor/perks/quantile/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ package quantile_test
import (
"bufio"
"fmt"
"github.com/bmizerany/perks/quantile"
"log"
"os"
"strconv"
"time"

"github.com/beorn7/perks/quantile"
)

func Example_simple() {
ch := make(chan float64)
go sendFloats(ch)

// Compute the 50th, 90th, and 99th percentile.
q := quantile.NewTargeted(0.50, 0.90, 0.99)
q := quantile.NewTargeted(map[float64]float64{
0.50: 0.005,
0.90: 0.001,
0.99: 0.0001,
})
for v := range ch {
q.Insert(v)
}
Expand All @@ -28,8 +33,8 @@ func Example_simple() {
fmt.Println("count:", q.Count())
// Output:
// perc50: 5
// perc90: 14
// perc99: 40
// perc90: 16
// perc99: 223
// count: 2388
}

Expand All @@ -52,7 +57,7 @@ func Example_mergeMultipleStreams() {
// even if we do not plan to query them all here.
ch := make(chan quantile.Samples)
getDBQuerySamples(ch)
q := quantile.NewTargeted(0.90)
q := quantile.NewTargeted(map[float64]float64{0.90: 0.001})
for samples := range ch {
q.Merge(samples)
}
Expand All @@ -67,7 +72,11 @@ func Example_window() {
go sendStreamValues(ch)

tick := time.NewTicker(1 * time.Minute)
q := quantile.NewTargeted(0.90, 0.95, 0.99)
q := quantile.NewTargeted(map[float64]float64{
0.90: 0.001,
0.95: 0.0005,
0.99: 0.0001,
})
for {
select {
case t := <-tick.C:
Expand Down
9 changes: 6 additions & 3 deletions _vendor/perks/quantile/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func TestHighBiasedQuery(t *testing.T) {
verifyHighPercsWithRelativeEpsilon(t, a, s)
}

func TestTargetedMerge(t *testing.T) {
// BrokenTestTargetedMerge is broken, see Merge doc comment.
func BrokenTestTargetedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewTargeted(Targets)
s2 := NewTargeted(Targets)
Expand All @@ -123,7 +124,8 @@ func TestTargetedMerge(t *testing.T) {
verifyPercsWithAbsoluteEpsilon(t, a, s1)
}

func TestLowBiasedMerge(t *testing.T) {
// BrokenTestLowBiasedMerge is broken, see Merge doc comment.
func BrokenTestLowBiasedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewLowBiased(RelativeEpsilon)
s2 := NewLowBiased(RelativeEpsilon)
Expand All @@ -133,7 +135,8 @@ func TestLowBiasedMerge(t *testing.T) {
verifyLowPercsWithRelativeEpsilon(t, a, s2)
}

func TestHighBiasedMerge(t *testing.T) {
// BrokenTestHighBiasedMerge is broken, see Merge doc comment.
func BrokenTestHighBiasedMerge(t *testing.T) {
rand.Seed(42)
s1 := NewHighBiased(RelativeEpsilon)
s2 := NewHighBiased(RelativeEpsilon)
Expand Down

0 comments on commit 3f532e7

Please sign in to comment.