Riemann にイベントを送信するアプリケーションの単体テストを作成しています。Riemann の起動は非常に遅いため、一度起動して、すべてのテストでインスタンスを再利用することにしました。したがって、新しい各テストの開始時に、以前のテストによって生成されたイベントからインデックスを消去する必要があります。
私がやろうとしているのは、特別なイベントを受け取ったときにインデックスをクリアするように Riemann を構成することです。このタスクに適していると思われる API 呼び出しがあります: http://riemann.io/api/riemann.index.html#var-clear。しかし、私は Clojure にあまり詳しくなく、使い方がわかりません。これが私の設定の一部です:
(streams
index
(where (state "clear-all")
(riemann.index/clear (:index @core))))
しかし、Riemann は次のエラーで開始できません。No implementation of method: :clear of protocol: #'riemann.index/Index found for class: nil
これ(:index @core)
は に評価されるようですnil
。
これも機能しません:
(streams
index
(where (state "clear-all")
(riemann.index/clear index)))
エラーは次のとおりです。No implementation of method: :clear of protocol: #'riemann.index/Index found for class: riemann.streams$default$stream__9829