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

ActivityId is always undefined in FeedResponse #23723

Open
6 tasks
victor-meng opened this issue Nov 4, 2022 · 10 comments
Open
6 tasks

ActivityId is always undefined in FeedResponse #23723

victor-meng opened this issue Nov 4, 2022 · 10 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos

Comments

@victor-meng
Copy link

victor-meng commented Nov 4, 2022

  • Package Name: @azure/cosmos
  • Package Version: 3.16.2
  • Operating system: Windows
  • nodejs
    • version:
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
ActivityId property is always undefined in FeedResponse.

To Reproduce
Steps to reproduce the behavior:

  1. Log into ms.azure.portal.com
  2. Open any Cosmos DB account
  3. Navigate to data explorer
  4. Run any query on a container
  5. Notice that the activityId is undefined in the response but is available in the response header

Expected behavior
A clear and concise description of what you expected to happen.
The correct activityId should be included in the FeedResponse.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context
Add any other context about the problem here.
Doc reference for FeedResponse: https://learn.microsoft.com/en-us/javascript/api/@azure/cosmos/feedresponse?view=azure-node-latest

@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 4, 2022
@azure-sdk azure-sdk added Client This issue points to a problem in the data-plane of the library. Cosmos needs-team-triage This issue needs the team to triage. labels Nov 4, 2022
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 4, 2022
@xirzec xirzec removed the needs-team-triage This issue needs the team to triage. label Nov 4, 2022
@topshot99
Copy link
Contributor

@victor-meng can you please share entire headers object. I don't see x-ms-activity-id field in the header which you shared.

@topshot99
Copy link
Contributor

@victor-meng we found it bit difficult to reproduce the object (shared in screen shot) by following the steps mentioned. Can you please describe your steps to reproduce more?

@victor-meng
Copy link
Author

victor-meng commented Nov 9, 2022

@topshot99 Here's the HAR file: ActivityId missing in FeedResponse.zip

The x-ms-activity-id is in the response header section:
image

@victor-meng
Copy link
Author

@victor-meng we found it bit difficult to reproduce the object (shared in screen shot) by following the steps mentioned. Can you please describe your steps to reproduce more?

You can only get the FeedResponse in the screenshot by setting break-points in our data explorer code. We get the FeedResponse after calling QueryIterator.fetchNext. Here's what we do in data explorer:

  1. We call client().database(databaseId).container(containerId).items.query(query, options) to get the query iterator.
  2. We call fetchNext on the query iterator to get the query response.

I imagine you should be able to reproduce this issue by making the same calls on any database and container.

@victor-meng
Copy link
Author

Another thing to add is that the ErrorResponse does contain the ActivityId:
image

@topshot99
Copy link
Contributor

Hey @victor-meng,

tried these configurations:
Package Name: @azure/cosmos
Package Version: 3.16.2
Operating system: Windows

over my system and ran this basic query mentioned in our readme document.

await container.items
        .query("SELECT * from c WHERE c.isCapitol = false")
        .fetchNext();

And I was getting activity id in the response also it was present inside header(check ss). Attaching screenshot here:
image
so, from this we can surely say that activity id is not undefined for all the query responses.
I guess it might be failing for some of the cases, but you need supply us more data in order to figure out those cases.
cc: @sajeetharan @v1k1

@victor-meng
Copy link
Author

victor-meng commented Nov 15, 2022

Thanks @topshot99 for investigating. I see that the basic query that you ran didn't include an options parameter, so I suspect the issue is with the FeedOptions that we are using. Here's the exact options object that we are passing to the SDK:
{
"enableCrossPartitionQuery": true,
"populateQueryMetrics": true,
"enableScanInQuery": true,
"forceQueryPlan": true,
"maxItemCount": 100,
"maxDegreeOfParallelism": 6
}

I checked the documentation for FeedOptions but it didn't mention anything about ActivityId: https://learn.microsoft.com/en-us/javascript/api/@azure/cosmos/feedoptions?view=azure-node-latest

@topshot99
Copy link
Contributor

topshot99 commented Nov 16, 2022

Hey @victor-meng ,
You are correct feed options is causing this issue. Also, I have figured out that these options ("forceQueryPlan": true and "maxDegreeOfParallelism": 6) is causing this issue. With these 2 options set sdk is not getting x-ms-activity-id header hence the value of activity id is undefined.
cc: @sajeetharan

@victor-meng
Copy link
Author

Awesome, thank you for confirming @topshot99 !

@abkolant-MSFT abkolant-MSFT removed their assignment Jan 24, 2023
@v1k1 v1k1 removed this from the azure-cosmos jan release milestone Feb 10, 2023
@sajeetharan
Copy link
Member

Check with Backend team to pass the activityid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos
Projects
None yet
Development

No branches or pull requests

7 participants