1
votes

I want to know responsible queries which consume higher RUs from cosmos db "Diagnostic Tools" support in cosmos db azure.

I am able to store the DataPlane logs into log analytics/blob storage from azure portal. While reviewing the logs, I see field named "requestcharge_s". To my understanding this is the RU consumed by that operation.

I want to know the exact underlying query that corresponds to this log entry. How can I get that? I do see "activityId_g" field in the log entry... But don't know if there is any way to get the exact query using that field value.

I am aware that, consumed RUs get returned as one of the HTTP header value while triggering query on cosmos db.. But, I would rather want to see it on azure portal for better in-place analysis.

I am missing something here?

1

1 Answers

0
votes

Bhupendra. Based on the properties table in the Interpret your logs, there is no such property which logs the exact query using RUs.

In fact,any operation on Cosmos DB will consume RUs and the diagnostic logging distinguishing the operation types by OperationName property.

You could get below clues in above link:

1.TimeGenerated,the date and time (UTC) when the operation occurred

2.OperationName,this value can be any of the following operations: Create, Update, Read, ReadFeed, Delete, Replace, Execute, SqlQuery, Query, JSQuery, Head, HeadFeed, or Upsert.

3.activityId_g,the unique GUID for the logged operation.

4.ResourceId,the value may point to databaseRid, collectionRid, or documentRid depending on the operation performed.

5.requestCharge_s,the number of RUs that are used by the operation.

I think you could basically locate where your client-side is sending the query. If you do want to know the specific query sql, you could add logs of printing SQL to your client-side, supplemented by operating time to locate.