question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CosmosDiagnostics changes from v3.15 to v3.20.1

See original GitHub issue

In SDK version 3.15 we took advantage of the following properties in the CosmosDiagnostics property of the response to record the following key metrics in Telemetry:

"DiagnosticVersion": "2",
        "Summary": {
            "StartUtc": "2021-08-19T19:08:12.8789031Z",
            "RunningElapsedTimeInMs": 184894.7196,
            "UserAgent": "cosmos-netstandard-sdk/3.15.0|3.15.2|01|X64|Microsoft Windows 10.0.18363|.NET Core 3.1.10|",
            "TotalRequestCount": 1,
            "FailedRequestCount": 0
        }

In version 3.20.1 the format of the CosmosDiagnostics json has changed significantly and the TotalRequestCount and FailedRequestCount are no longer there.:

"name": "CreateItemAsync",
    "id": "4ac11b57-5103-4a83-8c30-d19e0acb921d",
    "caller info": {
        "member": "OperationHelperWithRootTraceAsync",
        "file": "ClientContextCore.cs",
        "line": 219
    },
    "start time": "07:17:13:399",
    "duration in milliseconds": 8423.9044000000013,
    "data": {
        "Client Configuration": {
            "Client Created Time Utc": "2021-08-19T19:09:18.3183366Z",
            "NumberOfClientsCreated": 1,
            "User Agent": "cosmos-netstandard-sdk/3.20.1|3.19.3|1|X64|Microsoft Windows 10.0.18363 |.NET Core 4.6.29321.03|S|",
            "ConnectionConfig": {
                "gw": "(cps:50, urto:10, p:False, httpf: False)",
                "rntbd": "(cto: 5, icto: -1, mrpc: 30, mcpe: 65535, erd: False, pr: ReuseUnicastPort)",
                "other": "(ed:False, be:False)"
            },
            "ConsistencyConfig": "(consistency: NotSet, prgns:[])"
        }
    }

I would really like for those two properties to be put back. If not, is there another way we can get this information? For example by aggregating the retry counts on one or more of the Request Handler child objects if it exists. That would allow us to derive the data to meet our requirements.

Thank you, Steve

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stpetzingercommented, Oct 28, 2021

Thanks for the information. As you suggested, I will create a request for APIs for these values.

0reactions
j82wcommented, Oct 28, 2021

It’s recommend that you don’t try to parse the JSON because it will likely change in the future. I would suggest creating a GitHub issue asking for first class APIs on CosmosDiagnostics for the different values to avoid breaking changes in the future. As long as there is a good scenario for this information I don’t see an issue with adding the APIs.

StartUtc - I agree it should have the full date time. I think the correct solution for this would be to expose a GetStartTimeUtc on the CosmosDiagnostics.

RunningElapsedTimeInMs - Should use GetClientElapsedTime() off the CosmosDiagnostics: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/40075ebb1a732587703ea355039294a2633d881d/Microsoft.Azure.Cosmos/src/Diagnostics/CosmosDiagnostics.cs#L20

User agent string you are correct

Read more comments on GitHub >

github_iconTop Results From Across the Web

azure-cosmos-dotnet-v3/changelog.md at master
Fixed · #2776 Query: Fixes a bug where max page size is not being honored after the first 2 pages. · #2746 Bulk:...
Read more >
Migrate your application to use the Azure Cosmos DB .NET ...
This article highlights some of the considerations of upgrading your existing .NET application to the newer Azure Cosmos DB .NET SDK v3 for ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found