Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap already defined at #782

Open
mcorbin opened this issue Feb 22, 2017 · 0 comments
Open

Tap already defined at #782

mcorbin opened this issue Feb 22, 2017 · 0 comments

Comments

@mcorbin
Copy link
Contributor

mcorbin commented Feb 22, 2017

I have this config:

riemann.config

(include "foo/")

(require
  '[riemann.streams :refer :all]
  '[riemann.config :refer :all]
  '[foo.foo :as foo])

(logging/init {:file "/var/log/riemann/riemann.log"})

(let [host "0.0.0.0"]
  (tcp-server {:host host})
  (udp-server {:host host}))

(periodically-expire 10)

(streams
  (let [index (index)]
    foo/foo-stream))

foo/foo.clj

(ns foo.foo
  (:require
            [riemann.streams :refer :all]
            [riemann.config :refer :all]
            [riemann.test :refer :all]
            [foo.bar :as bar]))


(def foo-stream
  (sdo
    bar/bar-stream))

foo/bar.clj

(ns foo.bar
  (:require
            [riemann.streams :refer :all]
            [riemann.config :refer :all]
            [clojure.tools.logging :refer :all]
            [riemann.test :refer :all]))

(def bar-stream
  (where (service "bar-service")
   (tap :bar-stream-tap)
    #(info %)))

I launch riemann test riemann.config i have this stacktrace :

INFO [2017-02-22 17:03:34,866] main - riemann.bin - Loading /path/to/config/riemann.config
Exception in thread "main" java.lang.RuntimeException: Tap :bar-stream-tap (/path/to/config/foo/bar.clj:) already defined at :, compiling:(/path/to/config/foo/bar.clj:10:5)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6875)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:3228)
	at clojure.lang.Compiler.analyze(Compiler.java:6671)
	at clojure.lang.Compiler.access$300(Compiler.java:38)
	at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6269)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6001)
	at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5380)
	at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3972)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6866)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3766)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6870)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6231)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6856)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.access$300(Compiler.java:38)
	at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:589)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6868)
	at clojure.lang.Compiler.analyze(Compiler.java:6669)
	at clojure.lang.Compiler.analyze(Compiler.java:6625)
	at clojure.lang.Compiler.eval(Compiler.java:6931)
	at clojure.lang.Compiler.load(Compiler.java:7379)
	at clojure.lang.Compiler.loadFile(Compiler.java:7317)
	at clojure.lang.RT$3.invoke(RT.java:320)
	at riemann.config$include.invokeStatic(config.clj:415)
	at riemann.config$include.invoke(config.clj:393)
	at clojure.core$map$fn__4785.invoke(core.clj:2646)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.Cons.next(Cons.java:39)
	at clojure.lang.RT.next(RT.java:688)
	at clojure.core$next__4341.invokeStatic(core.clj:64)
	at clojure.core$dorun.invokeStatic(core.clj:3033)
	at clojure.core$dorun.invoke(core.clj:3024)
	at riemann.config$include.invokeStatic(config.clj:409)
	at riemann.config$include.invoke(config.clj:393)
	at riemann.config$eval24.invokeStatic(riemann.config:1)
	at riemann.config$eval24.invoke(riemann.config:1)
	at clojure.lang.Compiler.eval(Compiler.java:6927)
	at clojure.lang.Compiler.load(Compiler.java:7379)
	at clojure.lang.Compiler.loadFile(Compiler.java:7317)
	at clojure.lang.RT$3.invoke(RT.java:320)
	at riemann.config$include.invokeStatic(config.clj:415)
	at riemann.config$include.invoke(config.clj:393)
	at riemann.bin$_main$fn__12528.invoke(bin.clj:108)
	at riemann.bin$_main.invokeStatic(bin.clj:106)
	at riemann.bin$_main.doInvoke(bin.clj:85)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at riemann.bin.main(Unknown Source)
Caused by: java.lang.RuntimeException: Tap :bar-stream-tap (/path/to/config//foo/bar.clj:) already defined at :
	at riemann.test$tap.invokeStatic(test.clj:67)
	at riemann.test$tap.doInvoke(test.clj:46)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at clojure.lang.Var.invoke(Var.java:388)
	at clojure.lang.AFn.applyToHelper(AFn.java:160)
	at clojure.lang.Var.applyTo(Var.java:700)
	at clojure.lang.Compiler.macroexpand1(Compiler.java:6776)
	at clojure.lang.Compiler.analyzeSeq(Compiler.java:6854)
	... 62 more

When i move the tap in foo.clj (in sdo), it works.

When i replace (include "foo/") with (include "foo/foo.clj"), with the tap in bar.clj, it works.

It seems like i cannot define tap in a file included in another file included in riemann.config, and with a global (include) in riemann.config. I must use multiple (include) because of that.

Is it the expected behavior ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant