Skip to content

400 errors should show the actual error in the queryΒ #67

@rshivane

Description

@rshivane

Replication:
Fetch a missing metric using query API

Current behavior
The error raised does not indicate what is wrong with the query

Traceback (most recent call last):
  File "/home/ubuntu/Code/apptuit/tenants/bigbasket/es-glacier-snaphots/toktest.py", line 14, in <module>
    retry_count=3  # this will retry in case of 500 response or connection errors occur.
  File "/usr/local/lib/python2.7/dist-packages/apptuit/apptuit_client.py", line 362, in query
    "query service due to exception: %s" % str(http_error))
apptuit.apptuit_client.ApptuitException: Failed to get response from Apptuitquery service due to exception: 400 Client Error:  for url: https://api.apptuit.ai/api/query?start=1584607074&q=fetch%28%27missing_metric%27%29

Expectation
The API response has the error message that says the metric is missing. This message should be passed on to the API caller

{
   "status":"error",
   "message":"Query failed due to errors",
   "data":{
      "errors":[
         {
            "errorType":"ERROR_FETCHING_FROM_DATASOURCE",
            "queryLineNo":1,
            "queryColumnOffset":-1,
            "message":"Requested metrics(missing_metric) not found"
         }
      ]
   },
   "query_stats":{

   },
   "timing_diagnostics":[
   ],
   "query":{
      "querytext":"fetch('missing_metric')",
      "startTime":1584607112,
      "startTimeHumanReadableSYS":"March 19, 2020 8:38:32 AM UTC",
      "startTimeHumanReadableIST":"March 19, 2020 2:08:32 PM IST",
      "endTime":1584610762,
      "endTimeHumanReadableSYS":"March 19, 2020 9:39:22 AM UTC",
      "endTimeHumanReadableIST":"March 19, 2020 3:09:22 PM IST"
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions