<commit_before>(ns riemann.test.instrumentation
  (:require [riemann.logging :as logging])
  (:use clojure.test
        riemann.instrumentation
        riemann.time.controlled
        [riemann.time :only [unix-time]]))

(logging/init)
(use-fixtures :each reset-time!)
(use-fixtures :once control-time!)

(deftest measure-latency-test
         (let [r (rate+latency {:service "meow"
                                :meow true}
                               [0 3/5 1.0])]
           (dotimes [i 100]
             (measure-latency r (Thread/sleep 1)))
           
           (advance! 5)
           (let [es (events r)]
             ; Should have merged from the original event
             (is (every? true? (map :meow es)))

             ; Should emit a rate and quantiles
             (is (= ["riemann meow rate"
                     "riemann meow 0"
                     "riemann meow 3/5"
                     "riemann meow 1.0"]
                    (map :service es)))
<commit_msg>Fix instrumentation test.<commit_after>(ns riemann.test.instrumentation
  (:require [riemann.logging :as logging])
  (:use clojure.test
        riemann.instrumentation
        riemann.time.controlled
        [riemann.time :only [unix-time]]))

(logging/init)
(use-fixtures :each reset-time!)
(use-fixtures :once control-time!)

(deftest measure-latency-test
         (let [r (rate+latency {:service "meow"
                                :meow true}
                               [0 3/5 1.0])]
           (dotimes [i 100]
             (measure-latency r (Thread/sleep 1)))
           
           (advance! 5)
           (let [es (events r)]
             ; Should have merged from the original event
             (is (every? true? (map :meow es)))

             ; Should emit a rate and quantiles
             (is (= ["riemann meow rate"
                     "riemann meow latency 0"
                     "riemann meow latency 3/5"
                     "riemann meow latency 1.0"]
                    (map :service es)))

{'fraction_non_alphanumeric': 0.11116650049850449, 'fraction_numerical': 0.014955134596211365, 'mean_word_length': 1.480840543881335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5985687', 'n_tokens_mistral': 636, 'n_tokens_neox': 571, 'n_words': 165}