Issues with openobserve(v0.5.0) API Response Code

TLDR Shashank is facing issues with an API call getting a bad response code. Hengfei indicated the query may be incorrect and suggested an upgrade. Prabhat showed typical stream page queries. The issue is unresolved.

Photo of Shashank
Shashank
Thu, 10 Aug 2023 10:24:29 UTC

Hi Team, I using openobserve(v0.5.0). I am getting this response code when I am trying to filter metric data under stream based on time. ```Request URL: Request Method: POST Status Code: 400``` Response: ```{ "code": 400, "message": "invalid type: map, expected a string at line 1 column 16" }``` Payload: ```{"query":{"sql":{"changes":[{"range":{"startLineNumber":1,"startColumn":1,"endLineNumber":1,"endColumn":1},"rangeOffset":0,"rangeLength":0,"text":"SELECT * FROM \"apiserver_longrunning_requests\""}],"eol":"\r\n","versionId":2,"isUndoing":false,"isRedoing":false,"isFlush":true},"start_time":1691660627545000,"end_time":1691661527545000,"from":0,"size":150,"sql_mode":"full"}}``` Can someone pls help me on this !!

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:26:32 UTC

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:26:43 UTC

your query looks like is not correct.

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:26:55 UTC

we don't support `sql:changes`

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:27:21 UTC

and can you try v0.5.1?

Photo of Shashank
Shashank
Thu, 10 Aug 2023 10:27:34 UTC

Yah but this what UI is sending.

Photo of Shashank
Shashank
Thu, 10 Aug 2023 10:27:53 UTC

I got the details by inspecting my browser.

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:27:53 UTC

Yep, maybe it is a bug of 0.5.0. can you try 0.5.1?

Photo of Shashank
Shashank
Thu, 10 Aug 2023 10:28:16 UTC

Can you pls help me with the MR which fixed this :pray:

Photo of Shashank
Shashank
Thu, 10 Aug 2023 10:28:28 UTC

Currently we can not perform upgrade.

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:34:55 UTC

ah, i never got this error before. so i am not sure which pr fixed this problem.

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:35:02 UTC

and which page you got this error?

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:35:13 UTC

i tested v0.5.0 metrics, there is no this error.

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:36:57 UTC

and i suggest upgrade to 0.5.1, The old version doesn't provide great support for metrics

Photo of Hengfei
Hengfei
Thu, 10 Aug 2023 10:37:16 UTC

and 0.5.1 has no break changes to 0.5.0

Photo of Shashank
Shashank
Fri, 11 Aug 2023 06:39:31 UTC

Atleast can you pls point me to file where payload constructions happens ?

Photo of Shashank
Shashank
Fri, 11 Aug 2023 06:42:32 UTC

This API call gets triggered by UI when I hit run query under streams.

Photo of Shashank
Shashank
Fri, 11 Aug 2023 06:43:10 UTC

cc: Prabhat

Photo of Prabhat
Prabhat
Fri, 11 Aug 2023 21:00:10 UTC

am not sure how you got this query: ```{ "query": { "sql": { "changes": [ { "range": { "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 1 }, "rangeOffset": 0, "rangeLength": 0, "text": "SELECT * FROM \"apiserver_longrunning_requests\"" } ], "eol": "\r\n", "versionId": 2, "isUndoing": false, "isRedoing": false, "isFlush": true }, "start_time": 1691660627545000, "end_time": 1691661527545000, "from": 0, "size": 150, "sql_mode": "full" } }```

Photo of Prabhat
Prabhat
Fri, 11 Aug 2023 21:00:51 UTC

A typical query from stream page looks like: ```{ "query": { "sql": "SELECT * FROM \"apiserver_request_filter_duration_seconds_sum\"", "start_time": 1691786328940000, "end_time": 1691787228940000, "from": 0, "size": 150, "sql_mode": "full" } }```

Photo of Prabhat
Prabhat
Fri, 11 Aug 2023 21:01:57 UTC

or ```{ "query": { "sql": "SELECT * FROM \"apiserver_request_filter_duration_seconds_sum\" where filter='authorization'", "start_time": 1691786328940000, "end_time": 1691787228940000, "from": 0, "size": 150, "sql_mode": "full" } }```

Photo of Prabhat
Prabhat
Fri, 11 Aug 2023 21:06:39 UTC

can you share your query...