influxdata / influxdb-gds-connector

Google Data Studio Connector for InfluxDB.
MIT License
11 stars 4 forks source link

Error on measurments with a tag with different values #17

Closed SamuelLopez21 closed 2 years ago

SamuelLopez21 commented 2 years ago

Steps to reproduce: Configure the influx DB conector with the followeing data: 1) URL https://us-central1-1.gcp.cloud2.influxdata.com 2) Token given at InfluxDB Cloud 2.0 3) Ognaization configured at InfluxDB Cloud 2.0 4) Select one of the bucket you already created 5) Select a measurement 6) Leave "Scheme Query range" empty since you want to have a data range selector

Expect Behavior A windows with all the metrics and dimension detected by GDS

Actual behavior: I got the next error:

There was an error caused by the community connector. Please report the issue to the provider of this community connector if this issue persists.

Connector Details Cannot retrieve a Schema of your Measurement. InfluxDB Error Response: "invalid". Requested Query: "import "influxdata/influxdb/v1" bucket = "brechas" measurement = "Temperatura" start_range = duration(v: uint(v: 1970-01-01) - uint(v: now())) v1.tagKeys( bucket: bucket, predicate: (r) => r._measurement == measurement, start: start_range ) |> filter(fn: (r) => r._value != "_start" and r._value != "_stop" and r._value != "_measurement" and r._value != "_field") |> yield(name: "tags") from(bucket: bucket) |> range(start: start_range) |> filter(fn: (r) => r["_measurement"] == measurement) |> keep(fn: (column) => column == "_field" or column == "_value") |> unique(column: "_field") |> yield(name: "fields")"

Error ID: undefined

Specifications:

P.S This happen only with some measures. I am trying to figure out what is different with those measurements I got the error.

Since I am storing data data in both databases (Cloud 2.0 and influxDB V1.x), until now, I dont get any erros using influxDB V1.x

bednar commented 2 years ago

Hi @cmlopez4,

thanks for using our connector.

Do you have exact time when the error occurs? Can you test the schema query (https://github.com/influxdata/influxdb-gds-connector#schema-query) in the InfluxDB UI?

There is a following error in a connector's log:

{\"code\":\"invalid\",\"message\":\"runtime error @1:496-1:558: keep: schema collision detected: column \\\"_value\\\" is both of type int and float\"}

Regards

SamuelLopez21 commented 2 years ago

I tried this query from query builder in explora data ,

import "influxdata/influxdb/v1"

bucket = "brechas"
measurement = "Temperatura"
start_range = duration(v: uint(v: 1970-01-01) - uint(v: now()))

v1.tagKeys(
  bucket: bucket,
  predicate: (r) => r._measurement == measurement,
  start: start_range
) |> filter(fn: (r) => r._value != "_start" and r._value != "_stop" and r._value != "_measurement" and r._value != "_field")
  |> yield(name: "tags")

from(bucket: bucket)
  |> range(start: start_range)
  |> filter(fn: (r) => r["_measurement"] == measurement)
  |> keep(fn: (column) => column == "_field" or column == "_value")
  |> unique(column: "_field")
  |> yield(name: "fields")

I got this error: runtime error @17:6-17:68: keep: schema collision detected: column "_value" is both of type int and float

So, the error is due to the two types of the value?

The first time the sensor sent data to the database, was an int. after that, the sensor sent floats. Since is the temperature, there is a small chance the first measure to be an int.

IS there anything to set the type of the data before to send a single point?

I can change teh data type of the column?

Thanks

bednar commented 2 years ago

So, the error is due to the two types of the value?

Yes

The first time the sensor sent data to the database, was an int. after that, the sensor sent floats. Since is the temperature, there is a small chance the first measure to be an int.

IS there anything to set the type of the data before to send a single point?

You cannot set type, but you can send data as a float: iot,tag=a temperature=17.0.

I can change teh data type of the column?

I'm not expert to Flux, but probably with combination toFloat and set. Try to ask in our dedicated Slack channel for Flux - https://influxcommunity.slack.com/archives/CH8RGRW4T

Regards

bednar commented 2 years ago

This issue has been closed because it has not had recent activity. Please reopen if this issue is still important to you and you have additionally information.