Exemplo n.º 1
0
def test_timer_multiple_times_even(q, s):
    s.send("gorm:300|ms")
    s.send("gorm:200|ms")
    s.send("gorm:400|ms")
    s.send("gorm:100|ms")
    queue_skip(q, 10)
    t.same_stat(None, "stats.timers.gorm.median", 250, q.get(timeout=TIMEOUT))
    queue_skip(q, 4)
Exemplo n.º 2
0
def test_timer_multiple_times_even(q, s):
    s.send("gorm:300|ms")
    s.send("gorm:200|ms")
    s.send("gorm:400|ms")
    s.send("gorm:100|ms")
    queue_skip(q, 10)
    t.same_stat(None, "stats.timers.gorm.median", 250, q.get(timeout=TIMEOUT))
    queue_skip(q, 4)
Exemplo n.º 3
0
def test_multiple_counters(q, s):
    s.send("gorm:1|c")
    s.send("gurm:1|c")
    stats = {"stats.gorm": 2, "stats.gurm": 2}
    for i in range(2):
        stat = q.get()
        t.isin(stat[0], stats)
        t.eq(stats[stat[0]], stat[1])
        t.gt(stat[1], 0)
        stats.pop(stat[0])
    t.same_stat("stats.numStats", 2, q.get())
Exemplo n.º 4
0
def test_multiple_counters(q, s):
    s.send("gorm:1|c")
    s.send("gurm:1|c")
    stats = {
        "stats.gorm": 2,
        "stats_counts.gorm": 1,
        "stats.gurm": 2,
        "stats_counts.gurm": 1
    }
    for i in range(4):
        stat = q.get(timeout=TIMEOUT)
        t.isin(stat[1], stats)
        t.eq(stats[stat[1]], stat[2])
        t.gt(stat[2], 0)
        stats.pop(stat[1])
    t.same_stat(None, "stats.numStats", 2, q.get(timeout=TIMEOUT))
Exemplo n.º 5
0
def test_multiple_counters(q, s):
    s.send("gorm:1|c")
    s.send("gurm:1|c")
    stats = {
        "stats.gorm": 2,
        "stats_counts.gorm": 1,
        "stats.gurm": 2,
        "stats_counts.gurm": 1
    }
    for i in range(4):
        stat = q.get(timeout=TIMEOUT)
        t.isin(stat[1], stats)
        t.eq(stats[stat[1]], stat[2])
        t.gt(stat[2], 0)
        stats.pop(stat[1])
    t.same_stat(None, "stats.numStats", 2, q.get(timeout=TIMEOUT))
Exemplo n.º 6
0
def test_simple_counter_not_legacy_namespace(q, s):
    s.send("gorm:1|c")
    t.same_stat(None, "stats.counters.gorm.rate", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.counters.gorm.count", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 7
0
def test_simple_gauge(q, s):
    s.send("gorm:5|g")
    t.same_stat(None, "stats.gauges.gorm", 5, q.get())
    t.same_stat(None, "stats.numStats", 1, q.get())
Exemplo n.º 8
0
def test_simple_timer(q, s):
    for i in range(9):
        s.send("gorm:1|ms")
    s.send("gorm:2|ms")
    t.same_stat(None, "stats.timers.gorm.mean", 1, q.get())
    t.same_stat(None, "stats.timers.gorm.upper", 2, q.get())
    t.same_stat(None, "stats.timers.gorm.upper_90", 1, q.get())
    t.same_stat(None, "stats.timers.gorm.lower", 1, q.get())
    t.same_stat(None, "stats.timers.gorm.count", 10, q.get())
    t.same_stat(None, "stats.numStats", 1, q.get())
Exemplo n.º 9
0
def test_larger_count(q, s):
    s.send("gorm:5|c")
    t.same_stat(None, "stats.gorm", 10, q.get())
    t.same_stat(None, "stats_counts.gorm", 5, q.get())
    t.same_stat(None, "stats.numStats", 1, q.get())
Exemplo n.º 10
0
def test_multiple_messages(q, s):
    s.send("gorm:1|c")
    s.send("gorm:1|c")
    t.same_stat(None, "stats.gorm", 4, q.get())
    t.same_stat(None, "stats_counts.gorm", 2, q.get())
    t.same_stat(None, "stats.numStats", 1, q.get())
Exemplo n.º 11
0
def test_simple_counter(q, s):
    s.send("gorm:1|c")
    t.same_stat(None, "stats.gorm", 2, q.get())
    t.same_stat(None, "stats_counts.gorm", 1, q.get())
    t.same_stat(None, "stats.numStats", 1, q.get())
Exemplo n.º 12
0
def test_simple_timer(q, s):
    for i in range(9):
        s.send("gorm:1|ms")
    s.send("gorm:2|ms")  # Out of the 90% threshold
    t.same_stat(None, "stats.timers.gorm.mean_90", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 9, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 9, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 9, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 1.1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 20.0, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 11, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 13, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 0.3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 13
0
def test_multiple_messages(q, s):
    s.send("gorm:1|c")
    s.send("gorm:1|c")
    t.same_stat(None, "stats.gorm", 4, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats_counts.gorm", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 14
0
def test_timer_multiple_times(q, s):
    s.send("gorm:100|ms")
    s.send("gorm:200|ms")
    s.send("gorm:300|ms")  # Out of the 90% threshold
    t.same_stat(None, "stats.timers.gorm.mean_90", 150, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 200,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 300, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 50000,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 200, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 300, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 30, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 200, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 600, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 140000,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 81.64965809277261,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 15
0
def test_timer_single_time(q, s):
    s.send("gorm:100|ms")
    t.same_stat(None, "stats.timers.gorm.mean", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 10000,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 0, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 16
0
def test_timer_unsorted(q, s):
    s.send("gorm:2|ms")
    s.send("gorm:5|ms")
    s.send("gorm:7|ms")  # Out of the 90% threshold
    s.send("gorm:3|ms")
    t.same_stat(None, "stats.timers.gorm.mean_90", 10 / 3.0,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 5, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 38,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 17 / 4.0,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 7, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 4, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 8, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 4, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 17, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 87,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 1.920286436967152,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 17
0
def test_simple_counter_not_legacy_namespace(q, s):
    s.send("gorm:1|c")
    t.same_stat(None, "stats.counters.gorm.rate", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.counters.gorm.count", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 18
0
def test_simple_gauge(q, s):
    s.send("gorm:5|g")
    t.same_stat(None, "stats.gauges.gorm", 5, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 19
0
def test_timer_single_time(q, s):
    s.send("gorm:100|ms")
    t.same_stat(None, "stats.timers.gorm.mean", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 10000, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 0, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 20
0
def test_simple_counter(q, s):
    s.send("gorm:1|c")
    t.same_stat(None, "stats.gorm", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats_counts.gorm", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 21
0
def test_timer_multiple_times(q, s):
    s.send("gorm:100|ms")
    s.send("gorm:200|ms")
    s.send("gorm:300|ms")  # Out of the 90% threshold
    t.same_stat(None, "stats.timers.gorm.mean_90", 150, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 200, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 300, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 50000, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 200, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 300, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 100, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 30, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 200, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 600, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 140000, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 81.64965809277261, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 22
0
def test_larger_count(q, s):
    s.send("gorm:5|c")
    t.same_stat(None, "stats.gorm", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats_counts.gorm", 5, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 23
0
def test_simple_timer(q, s):
    for i in range(9):
        s.send("gorm:1|ms")
    s.send("gorm:2|ms")  # Out of the 90% threshold
    t.same_stat(None, "stats.timers.gorm.mean_90", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 9, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 9, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 9,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 1.1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 20.0,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 11, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 13,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 0.3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 24
0
def test_simple_timer(q, s):
    for i in range(9):
        s.send("gorm:1|ms")
    s.send("gorm:2|ms")
    t.same_stat(None, "stats.timers.gorm.mean", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 1, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 20.0,
                q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))
Exemplo n.º 25
0
def test_timer_unsorted(q, s):
    s.send("gorm:2|ms")
    s.send("gorm:5|ms")
    s.send("gorm:7|ms")  # Out of the 90% threshold
    s.send("gorm:3|ms")
    t.same_stat(None, "stats.timers.gorm.mean_90", 10 / 3.0, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper_90", 5, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_90", 3, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_90", 10, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares_90", 38, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.mean", 17 / 4.0, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.upper", 7, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.lower", 2, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count", 4, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.count_ps", 8, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.median", 4, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum", 17, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.sum_squares", 87, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.timers.gorm.std", 1.920286436967152, q.get(timeout=TIMEOUT))
    t.same_stat(None, "stats.numStats", 1, q.get(timeout=TIMEOUT))