mblackstock / node-red-contrib-influxdb

Node-RED nodes to save and query data from an influxdb time series database
Other
64 stars 44 forks source link

version 2.0 connection is dropping tags, if tagvalue is 0 #126

Closed JGoltermann closed 2 years ago

JGoltermann commented 2 years ago

Hello,

I have a working flow which sends mqtt data to an influx db. I recently upgraded the influxdb from 1.8 to 2.3 and after switching the connection inside the influxdb node from version 1.x to 2.0. I realized a strange behavior.

All tags with the value 0 eg. string=0 are missing inside the influxdb. Switching back to server version 1.x solved the problem.

After digging around and capturing some TCP connections I'm sure, that the tags are dropped in the node-red-contrib-influxdb code or the influxdb-client library.

I have configured a flow with two influxdb output nodes, one uses v1.8 which works great and the second uses a version 2.0 to export the same msg. Tags with values != 0 are exported in both versions, but tagvalues == 0 are dropped on the version 2.0 connection:

I have attached 4 tcpdump parts.


tag: string=0, v1: good
        0x0000:  4500 00dc 969b 4000 4006 f74b c111 1509  E.....@.@..K....
        0x0010:  c111 1509 e9b0 1f96 3ebb c6b0 e86f 1f89  ........>....o..
        0x0020:  8018 0200 ad03 0000 0101 080a 707f 07d0  ............p...
        0x0030:  707f 07aa 504f 5354 202f 7772 6974 653f  p...POST./write?
        0x0040:  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        0x0050:  xxxxxxxxxxxxxxxxxxxxxxxxx2670 7265 6369  xxxxxxxxxx&preci
        0x0060:  7369 6f6e 3d73 2672 703d 2675 3d6e 6f64  sion=s&rp=&u=nod
        0x0070:  6572 6564 2048 5454 502f 312e 310d 0a63  ered.HTTP/1.1..c
        0x0080:  6f6e 7465 6e74 2d6c 656e 6774 683a 2032  ontent-length:.2
        0x0090:  370d 0a48 6f73 743a xxxxxxxxxxxxxxxxxxx  7..Host:.xxxxx.x
        0x00a0:  6267 2e64 653a 3830 3836 0d0a 436f 6e6e  xx.de:8086..Conn
        0x00b0:  6563 7469 6f6e 3a20 636c 6f73 650d 0a0d  ection:.close...
        0x00c0:  0a68 6d64 7475 2c73 7472 696e 673d 3020  .hmdtu,string=0.
        0x00d0:  7969 656c 6464 6179 3d38 3439            yieldday=849

tag: string=0, v2: bad, tag: sting=0 is missing
        0x0000:  4500 019e df50 4000 4006 add4 c111 1509  E....P@.@.......
        0x0010:  c111 1509 e9bc 1f96 e614 6f81 4b1a 6d93  ..........o.K.m.
        0x0020:  8018 0200 adc5 0000 0101 080a 707f 07d1  ............p...
        0x0030:  707f 07aa 504f 5354 202f 6170 692f 7632  p...POST./api/v2
        0x0040:  2f77 7269 7465 3f6f 7267 3d67 6f68 6f26  /write?org=goho&
        0x0050:  6275 636b 6574 3d67 6f68 6f25 3246 6175  bucket=goho%2Fau
        0x0060:  746f 6765 6e26 7072 6563 6973 696f 6e3d  togen&precision=
        0x0070:  6d73 2048 5454 502f 312e 310d 0a63 6f6e  ms.HTTP/1.1..con
        0x0080:  7465 6e74 2d74 7970 653a 2074 6578 742f  tent-type:.text/
        0x0090:  706c 6169 6e3b 2063 6861 7273 6574 3d75  plain;.charset=u
        0x00a0:  7466 2d38 0d0a 5573 6572 2d41 6765 6e74  tf-8..User-Agent
        0x00b0:  3a20 696e 666c 7578 6462 2d63 6c69 656e  :.influxdb-clien
        0x00c0:  742d 6a73 2f31 2e32 372e 300d 0a61 7574  t-js/1.27.0..aut
        0x00d0:  686f 7269 7a61 7469 6f6e 3a20 546f 6b65  horization:.Toke
        0x00e0:  6e20 724a 4963 686e 474e 6757 6630 676a  n.rJIchnGNgWf0gj
        0x00f0:  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
        0x0100:  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        0x0110:  4e75 777a 4836 4a50 3653 6356 664f 3573  NuwzH6JP6ScVfO5s
        0x0120:  3572 5265 4950 3875 6138 6552 6464 5544  5rReIP8ua8eRddUD
        0x0130:  7374 3645 6974 5951 3d3d 0d0a 636f 6e74  st6EitYQ==..cont
        0x0140:  656e 742d 6c65 6e67 7468 3a20 3332 0d0a  ent-length:.32..
        0x0150:  486f 7374 xxxxxxxxxxxxxxxxxxxxxxxxxxxxx  Host:.xxxxx.xxx.
        0x0160:  6465 3a38 3038 360d 0a43 6f6e 6e65 6374  de:8086..Connect
        0x0170:  696f 6e3a 2063 6c6f 7365 0d0a 0d0a 686d  ion:.close....hm
        0x0180:  6474 7520 7969 656c 6464 6179 3d38 3439  dtu.yieldday=849
        0x0190:  2031 3635 3935 3231 3136 3438 3032       .1659521164802

tag: sting=1, v1: good
        0x0000:  4500 00dc f989 4000 4006 945d c111 1509  E.....@.@..]....
        0x0010:  c111 1509 ea6c 1f96 1a0b 81f4 8fee 5ee2  .....l........^.
        0x0020:  8018 0200 ad03 0000 0101 080a 707f 07d6  ............p...
        0x0030:  707f 07ab 504f 5354 202f 7772 6974 653f  p...POST./write?
        0x0040: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        0x0050:  xxxxxxxxxxxxxxxxxxxx7a32 2670 7265 6369  xxxxxxxxxx2&preci
        0x0060:  7369 6f6e 3d73 2672 703d 2675 3d6e 6f64  sion=s&rp=&u=nod
        0x0070:  6572 6564 2048 5454 502f 312e 310d 0a63  ered.HTTP/1.1..c
        0x0080:  6f6e 7465 6e74 2d6c 656e 6774 683a 2032  ontent-length:.2
        0x0090:  370d 0a48 6f73 743a xxxxxxxxxxxxxxxxxxx  7..Host:.xxxxx.x
        0x00a0:  6267 2e64 653a 3830 3836 0d0a 436f 6e6e  xx.xx:8086..Conn
        0x00b0:  6563 7469 6f6e 3a20 636c 6f73 650d 0a0d  ection:.close...
        0x00c0:  0a68 6d64 7475 2c73 7472 696e 673d 3120  .hmdtu,string=1.
        0x00d0:  766f 6c74 6167 653d 3334 2e31            voltage=34.1

tag: string=1, v2: good too
        0x0000:  4500 01a7 6fef 4000 4006 1d2d c111 1509  E...o.@.@..-....
        0x0010:  c111 1509 ea7a 1f96 eadf 4a0a 5b19 bf42  .....z....J.[..B
        0x0020:  8018 0200 adce 0000 0101 080a 707f 07d6  ............p...
        0x0030:  707f 07ab 504f 5354 202f 6170 692f 7632  p...POST./api/v2
        0x0040:  2f77 7269 7465 3f6f 7267 3d67 6f68 6f26  /write?org=goho&
        0x0050:  6275 636b 6574 3d67 6f68 6f25 3246 6175  bucket=goho%2Fau
        0x0060:  746f 6765 6e26 7072 6563 6973 696f 6e3d  togen&precision=
        0x0070:  6d73 2048 5454 502f 312e 310d 0a63 6f6e  ms.HTTP/1.1..con
        0x0080:  7465 6e74 2d74 7970 653a 2074 6578 742f  tent-type:.text/
        0x0090:  706c 6169 6e3b 2063 6861 7273 6574 3d75  plain;.charset=u
        0x00a0:  7466 2d38 0d0a 5573 6572 2d41 6765 6e74  tf-8..User-Agent
        0x00b0:  3a20 696e 666c 7578 6462 2d63 6c69 656e  :.influxdb-clien
        0x00c0:  742d 6a73 2f31 2e32 372e 300d 0a61 7574  t-js/1.27.0..aut
        0x00d0:  686f 7269 7a61 7469 6f6e 3a20 546f 6b65  horization:.Toke
        0x00e0:  6e20 724a 4963 686e 474e 6757 6630 676a  n.rJIchnGNgWf0gj
        0x00f0:  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        0x0100:  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        0x0110:  4e75 777a 4836 4a50 3653 6356 664f 3573  NuwzH6JP6ScVfO5s
        0x0120:  3572 5265 4950 3875 6138 6552 6464 5544  5rReIP8ua8eRddUD
        0x0130:  7374 3645 6974 5951 3d3d 0d0a 636f 6e74  st6EitYQ==..cont
        0x0140:  656e 742d 6c65 6e67 7468 3a20 3431 0d0a  ent-length:.41..
        0x0150:  486f 7374 3a20 xxxxxxxxxxxxxxxxxxxxxxxx  Host:.xxxxxx.xxx.
        0x0160:  6465 3a38 3038 360d 0a43 6f6e 6e65 6374  de:8086..Connect
        0x0170:  696f 6e3a 2063 6c6f 7365 0d0a 0d0a 686d  ion:.close....hm
        0x0180:  6474 752c 7374 7269 6e67 3d31 2076 6f6c  dtu,string=1.vol
        0x0190:  7461 6765 3d33 342e 3120 3136 3539 3532  tage=34.1.165952
        0x01a0:  3131 3634 3831 34                        1164814

Who can help to resolve this issue?

Thank you very much.

JGoltermann commented 2 years ago

Hello,

sorry, my vault, if the tag value is a string, as supposed to be, it works in both versions.

This problem only occurs, if the tag value is an integer.