Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[monitor-query] Batch queries will occasionally fail to deserialize due to an incorrectly formatted response body #15688

Closed
richardpark-msft opened this issue Jun 11, 2021 · 7 comments
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor Monitor, Monitor Ingestion, Monitor Query

Comments

@richardpark-msft
Copy link
Member

richardpark-msft commented Jun 11, 2021

The service (randomly) will return an improperly formatted body for a batch request.

Example:

The request we sent:

{
    "url": "https://api.loganalytics.io/v1/$batch",
    "method": "POST",
    "headers": {
      "_headersMap": {
        "content-type": {
          "name": "content-type",
          "value": "application/json"
        },
        "accept": {
          "name": "accept",
          "value": "application/json"
        },
        "user-agent": {
          "name": "user-agent",
          "value": "core-http/1.2.6 Node/v12.15.0 OS/(x64-Windows_NT-10.0.19043)"
        },
        "x-ms-client-request-id": {
          "name": "x-ms-client-request-id",
          "value": "c292e40f-cabd-4acb-988c-f364f06c85f0"
        },
        "authorization": {
          "name": "authorization",
          "value": "Bearer <proper bearer token was here>"
        },
        "cookie": {
          "name": "Cookie",
          "value": ""
        }
      }
    },
    "body": "{\"requests\":[{\"id\":\"0\",\"body\":{\"query\":\"print \\\"hello\\\", true, make_datetime(\\\"2000-01-02 03:04:05Z\\\"), toint(100), long(101), 102.1, dynamic({ \\\"hello\\\": \\\"world\\\" })\\n      | project \\n          stringcolumn=print_0, \\n          boolcolumn=print_1,\\n          datecolumn=print_2,\\n          intcolumn=print_3,\\n          longcolumn=print_4,\\n          realcolumn=print_5,\\n          dynamiccolumn=print_6\\n      \",\"timespan\":\"PT5M\"},\"path\":\"/query\",\"method\":\"POST\",\"workspace\":\"1c1ef545-f240-4740-987a-52cdb50ad087\"}]}",
  }

The response, with the body seeming to be double-serialized:

{"responses":[{"id":"0","status":200,"headers":{"Age":"0","request-context":"appId=cid-v1:70941e4f-7e8f-40b7-b730-183893db0297"},"body":"{\"tables\":[{\"name\":\"PrimaryResult\",\"columns\":[{\"name\":\"stringcolumn\",\"type\":\"string\"},{\"name\":\"boolcolumn\",\"type\":\"bool\"},{\"name\":\"datecolumn\",\"type\":\"datetime\"},{\"name\":\"intcolumn\",\"type\":\"int\"},{\"name\":\"longcolumn\",\"type\":\"long\"},{\"name\":\"realcolumn\",\"type\":\"real\"},{\"name\":\"dynamiccolumn\",\"type\":\"dynamic\"}],\"rows\":[[\"hello\",true,\"2000-01-02T03:04:05Z\",100,101,102.1,\"{\\\"hello\\\":\\\"world\\\"}\"]]}]}"}]}

In contrast, here the body of a response when things succeed:

{"responses":[{"id":"0","status":200,"headers":{"Age":"60","request-context":"appId=cid-v1:70941e4f-7e8f-40b7-b730-183893db0297"},"body":{"tables":[{"name":"PrimaryResult","columns":[{"name":"stringcolumn","type":"string"},{"name":"boolcolumn","type":"bool"},{"name":"datecolumn","type":"datetime"},{"name":"intcolumn","type":"int"},{"name":"longcolumn","type":"long"},{"name":"realcolumn","type":"real"},{"name":"dynamiccolumn","type":"dynamic"}],"rows":[["hello",true,"2000-01-02T03:04:05Z",100,101,102.1,"{\"hello\":\"world\"}"]]}]}}]}

The first one appears to have double-encoded the 'body' field, essentially, so it doesn't deserialize properly in the client.

@richardpark-msft richardpark-msft added Client This issue points to a problem in the data-plane of the library. Monitor - Query labels Jun 11, 2021
@richardpark-msft richardpark-msft added this to the [2021] July milestone Jun 11, 2021
@richardpark-msft richardpark-msft self-assigned this Jun 11, 2021
@richardpark-msft
Copy link
Member Author

CC: @srnagar, @pakrym , @rakshith91

@richardpark-msft
Copy link
Member Author

Same issue, but with the .net SDK: Azure/azure-sdk-for-net#21655

richardpark-msft added a commit that referenced this issue Jun 14, 2021
The Log Analytics service has a bug where it sometimes returns the batch query output encoded twice. 

The issue is still under investigation (#15688) but in the meantime this workaround will enable people to use the API, which is critical since we're in preview.

Mitigation for #15688
@ramya-rao-a ramya-rao-a added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jun 15, 2021
sadasant pushed a commit to sadasant/azure-sdk-for-js that referenced this issue Jun 21, 2021
The Log Analytics service has a bug where it sometimes returns the batch query output encoded twice. 

The issue is still under investigation (Azure#15688) but in the meantime this workaround will enable people to use the API, which is critical since we're in preview.

Mitigation for Azure#15688
@richardpark-msft
Copy link
Member Author

Adding @KarishmaGhiya, as this is an active bug that will require changes later.

@rakshith91
Copy link

Yay!! Finally able to reproduce this in python

@richardpark-msft richardpark-msft removed their assignment Jun 30, 2021
@richardpark-msft
Copy link
Member Author

There is a workaround currently in main from #15718. Remove once this is solved from the service side.

@KarishmaGhiya
Copy link
Member

Service team is aware, but no ETA on the fix. Moving to backlog

@KarishmaGhiya KarishmaGhiya modified the milestones: [2021] August, Backlog Jul 27, 2021
@scottaddie scottaddie added the Monitor Monitor, Monitor Ingestion, Monitor Query label Jun 15, 2022
Copy link

Hi @richardpark-msft, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2024
@xirzec xirzec removed this from the Backlog milestone May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Client This issue points to a problem in the data-plane of the library. Monitor Monitor, Monitor Ingestion, Monitor Query
Projects
None yet
Development

No branches or pull requests

6 participants