我正在为向黎曼发送事件的应用程序编写单元测试。Riemann 启动非常缓慢,所以我决定启动一次,然后将实例重用于所有测试。因此,我需要在每个新测试开始时从先前测试产生的事件中清除索引。
我想要做的是以这样一种方式配置黎曼,即在接收到特殊事件时它将清除其索引。有一个似乎适合该任务的 API 调用:http ://riemann.io/api/riemann.index.html#var-clear 。但是我对 Clojure 不是很熟悉,我不知道如何使用它。这是我的配置的一部分:
(streams
index
(where (state "clear-all")
(riemann.index/clear (:index @core))))
但黎曼未能从这个错误开始: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