clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
Adam Kalisz 2021-05-15T00:01:02.381100Z

Thank you @hiredman so I have to somehow split the message in the application or would e.g. Sente do it for me? Would increasing the size e.g. to 1 MB have some negative consequences?

Adam Kalisz 2021-05-15T00:21:29.382800Z

I have updated the issue. From looking into get-sch-adapter in taoensso.sente.server-adapters.aleph the implementation doesn't seem to accept any options that could be consumed by websocket-connection in aleph.http. So I probably could increase the max-frame-payload a bit but would have to first patch the Sente server adapter for Aleph.

Adam Kalisz 2021-05-15T00:22:56.384200Z

I wonder, how do other people solve this? Do people split everything in the implementation to fit into a frame/ the message? Do people use other adapters or just maybe Aleph directly? As you can see, I am a bit lost. ๐Ÿ™‚

2021-05-15T00:27:39.384300Z

I doubt most people send frames that large

2021-05-15T00:30:17.384400Z

The websocket protocol has a frame splitting mechanism built, but I don't recall how that is used

Adam Kalisz 2021-05-15T00:34:41.385800Z

Do you think people generally send less data over websockets or just use smaller messages and send more of them?

2021-05-15T00:46:04.386Z

I guess I don't really know. A websocket connection can send one frame at a time, so if you are sending a large frame, other frames will be backed up behind it

2021-05-15T00:46:17.386100Z

But 64k isn't that big

2021-05-15T00:49:19.386200Z

Our websocket usage at work is largely for timely small message delivery (it is part of a chat server), anything large (images, etc) is served over http

Adam Kalisz 2021-05-15T00:49:59.386600Z

As in AJAX?

Adam Kalisz 2021-05-15T00:52:31.388800Z

We have an app, where you can manipulate multiple elements on a worksheet e.g. by Copy&Paste - this potentially creates quite a bit of churn and the messages get proportionally large-ish. E.g. manipulating ~ 100 elements creates messages above 64k since every element has a color, position, size, content etc.

Adam Kalisz 2021-05-15T00:53:35.389600Z

We use the AJAX route for files, e.g. pictures, videos, PDFs etc.

2021-05-15T00:56:53.389700Z

Yeah ajax

Adam Kalisz 2021-05-15T00:57:41.390300Z

Ok, thank you for the comments and tips

valerauko 2021-05-15T15:08:06.391900Z

the docs say that defrecord fields can have type hints, but this does not seem to work? even with type hints on the fields, when i try to use it elsewhere it still gets reflected as java.lang.Object

valerauko 2021-05-15T15:08:16.392100Z

is there a way around this?

Pradeep Chhetri 2021-05-15T15:40:31.393200Z

Hi everyone, i am trying to add influxdbโ€™s v2 support to riemann. My changes are here: https://github.com/chhetripradeep/riemann/pull/1/files But when i try to run this code, it gives error https://gist.github.com/chhetripradeep/c5df294c5e5ff4fb2019136765d15209 I am unable to figure out the cause of it.

valerauko 2021-05-15T15:45:52.393300Z

my first guess would be that your post-datapoint returns a string when it catches an exception (instead of printing it), which might not be the return type whatever is calling it expects?

Pradeep Chhetri 2021-05-15T15:51:04.393500Z

I see. thank you for the pointers. i am new to clojure. let me try.

valerauko 2021-05-15T15:55:09.393700Z

try putting println instead of str and see what happens

๐Ÿ‘ 1
Pradeep Chhetri 2021-05-15T16:01:49.394Z

i tried replacing the str with println in post-datapoint func but still see the same stacktrace.

valerauko 2021-05-15T16:21:47.394200Z

Try adjusting your dependency like this

[com.influxdb/influxdb-client-java "2.2.0" :exclusions [com.squareup.retrofit2/retrofit]]

Pradeep Chhetri 2021-05-15T16:24:24.394400Z

Sure trying

Pradeep Chhetri 2021-05-15T16:27:27.394600Z

Still the same error. Thank you for continuous help. Much appreciated.

valerauko 2021-05-15T16:35:56.394800Z

that's really weird. so from what i see this error is caused at this line: https://github.com/square/retrofit/blob/fbf1225e28e2094bec35f587b8933748b705d167/retrofit-converters/scalars/src/main/java/retrofit2/converter/scalars/ScalarRequestBodyConverter.java#L25 except that method signature no longer exists in okhttp: https://github.com/square/okhttp/pull/5132 so i figured you might be adding a too recent version of the influxdb dependency thus causing a version collision... this seems to be happening too, since lein deps :tree tells me

[org.influxdb/influxdb-java "2.8"] -> [com.squareup.retrofit2/retrofit "2.3.0"]
 overrides
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.squareup.retrofit2/converter-gson "2.9.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.squareup.retrofit2/converter-scalars "2.9.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.influxdb/influxdb-client-core "2.2.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"]

Consider using these exclusions:
[com.influxdb/influxdb-client-java "2.2.0" :exclusions [com.squareup.retrofit2/retrofit]]

[org.influxdb/influxdb-java "2.8"] -> [com.squareup.okhttp3/okhttp "3.9.1"]
 overrides
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.squareup.retrofit2/converter-gson "2.9.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"] -> [com.squareup.okhttp3/okhttp "3.14.9"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.squareup.retrofit2/converter-scalars "2.9.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"] -> [com.squareup.okhttp3/okhttp "3.14.9"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.influxdb/influxdb-client-core "2.2.0"] -> [com.squareup.okhttp3/logging-interceptor "4.7.2"] -> [com.squareup.okhttp3/okhttp "4.7.2"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.influxdb/influxdb-client-core "2.2.0"] -> [com.squareup.retrofit2/retrofit "2.9.0"] -> [com.squareup.okhttp3/okhttp "3.14.9"]
 and
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.influxdb/influxdb-client-core "2.2.0"] -> [com.squareup.okhttp3/okhttp "4.7.2"]

Consider using these exclusions:
[com.influxdb/influxdb-client-java "2.2.0" :exclusions [com.squareup.okhttp3/okhttp]]

[org.influxdb/influxdb-java "2.8"] -> [com.squareup.okhttp3/logging-interceptor "3.9.1"]
 overrides
[com.influxdb/influxdb-client-java "2.2.0"] -> [com.influxdb/influxdb-client-core "2.2.0"] -> [com.squareup.okhttp3/logging-interceptor "4.7.2"]

Consider using these exclusions:
[com.influxdb/influxdb-client-java "2.2.0" :exclusions [com.squareup.okhttp3/logging-interceptor]]

[com.influxdb/influxdb-client-java "2.2.0"] -> [com.google.code.gson/gson "2.8.5"]
 overrides
[com.influxdb/influxdb-client-java "2.2.0"] -> [io.gsonfire/gson-fire "1.8.4"] -> [com.google.code.gson/gson "2.8.6"]

Consider using these exclusions:
[com.influxdb/influxdb-client-java "2.2.0" :exclusions [com.google.code.gson/gson]]

valerauko 2021-05-15T16:37:03.395100Z

https://mvnrepository.com/artifact/com.influxdb/influxdb-client-java/2.2.0 https://mvnrepository.com/artifact/org.influxdb/influxdb-java/2.8 there must be a version mismatch in there somewhere that causes your error

valerauko 2021-05-15T16:39:30.395300Z

you can try upgrading influxdb-java to 2.21 (latest) and see what happens... or use an old version of influxdb-client-java which has "closer" dependency versions to those of influxdb-java 2.8

Pradeep Chhetri 2021-05-15T16:39:54.395500Z

Interesting. Nice find @vale sure

๐Ÿ‘ 1
Pradeep Chhetri 2021-05-15T16:42:39.395800Z

Thank you so much @vale That did solved the problem. ๐ŸŽ‰ Great debugging.

๐Ÿ’ฏ 1
valerauko 2021-05-15T16:44:10.396Z

sure thing~ maven dependency resolution can do that to you... then again if you did bump an existing dependency that might make your pr hard to merge since the change might break other code...

Pradeep Chhetri 2021-05-15T16:45:57.396300Z

I agree, I will try my best to verify on my end that the existing dependency bump doesnโ€™t break influxdb v1 integration. Thank you once again for your help.

valerauko 2021-05-15T16:46:10.396600Z

no problem! good luck

๐Ÿ™‡ 1
alexmiller 2021-05-15T17:06:23.397100Z

defrecord fields are always Object (or primitive long/double)

alexmiller 2021-05-15T17:07:14.397300Z

so, there is no way around that if you are trying to access the fields directly