eclipse-zenoh / zenoh-backend-influxdb

Backend and Storages for zenoh using InfluxDB
Other
19 stars 18 forks source link

[Bug] `**` Not working for inflixdb2 #42

Open patrickelectric opened 9 months ago

patrickelectric commented 9 months ago

Describe the bug

When using curl -X GET http://localhost:8000/\*\* no data come from influxdb2 after a post method. Different from influxdb

To reproduce

 docker run \
      -p 8086:8086 \
      -v myInfluxVolume:/var/lib/influxdb2 \
      influxdb:1.8

./zenohd -c influx.json5 --adminspace-permissions=rw

curl -X PUT -d '"Hello World!"' http://localhost:8000/demo/example/test 
curl -X GET http://localhost:8000/\*\* 

my influx.json5

{
  plugins: {
    storage_manager: {
      volumes: {
        influxdb: {
          // URL to the InfluxDB service
          url: "http://0.0.0.0:8086",
          private: {
            token: "eCqM_gNl9fbVZE4JeQTtcLgI28vGztI2yQJUn7Kf5c4m73JaweWbgZJvydvhRVtFvAHAhftIeegCDkQVsalZZA=="
          }
        }
      },
      storages: {
        demo: {
          key_expr: "demo/example/**",
          strip_prefix: "demo/example",
          volume: {
            id: "influxdb",
            db: "test",
            create_db: true,
            on_closure: "drop_db",
            private: {
              token: "eCqM_gNl9fbVZE4JeQTtcLgI28vGztI2yQJUn7Kf5c4m73JaweWbgZJvydvhRVtFvAHAhftIeegCDkQVsalZZA=="
            }
          }
        }
      }
    },
    rest: { http_port: 8000 }
  }
}

This steps work in influxdb but fail in influxdb2, the config need to change for influxdb since the username and password are required for this version.

System info

The zenoh router v0.10.0-rc built with rustc 1.72.0 (5680fa18f 2023-08-23)

                   -`                 
                  .o+`                 patrick@pichau
                 `ooo/                 OS: Arch Linux 
                `+oooo:                Kernel: x86_64 Linux 6.5.9-arch2-1
               `+oooooo:               Uptime: 14d 19h 34m
               -+oooooo+:              Packages: 2689
             `/:-:++oooo+:             Shell: zsh 5.9
            `/++++/+++++++:            Resolution: 7680x2160
           `/++++++++++++++:           DE: KDE 5.111.0 / Plasma 5.27.9
          `/+++ooooooooooooo/`         WM: KWin
         ./ooosssso++osssssso+`        GTK Theme:  [GTK2/3]
        .oossssso-````/ossssss+`       Icon Theme: bloom
       -osssssso.      :ssssssso.      Disk: 800G / 911G (92%)
      :osssssss/        osssso+++.     CPU: AMD Ryzen 7 2700 Eight-Core @ 16x 3.2GHz
     /ossssssss/        +ssssooo/-     GPU: NVIDIA GeForce GTX 1060 6GB
   `/ossssso+/:-        -:/+osssso+-   RAM: 33051MiB / 64247MiB
  `+sso+:-`                 `.-/+oso: 
 `++:.                           `-/+/
 .`                                 `/
snehilzs commented 9 months ago

@patrickelectric Thanks for bringing this to our attention. I will look into it and get back to you.

snehilzs commented 9 months ago

Hi @patrickelectric , Influxdb 2.x doesn't support our current approach to get all entries (the ** expression) that was valid in 1.x. Our get_all_entries function should retrieve the last stored value per _measurement. For that we require access to the list of _measurement (key-expressions in case of zenoh) stored in the bucket and then iterate through the list items, querying for the last stored value for each. However, Influxdb 2.x doesn't provide the option to get the list of _measurement through their API. We are currently working on a workaround or alternative approach to provide this.

patrickelectric commented 9 months ago

Thanks!

samcarey commented 5 months ago

We are currently working on a workaround or alternative approach to provide this.

Any update on this? Does the workaround still seem possible?