Invalid JSON produced by Cosmos Diagnostics
See original GitHub issueWe are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.
Describe the bug JSON format is not correct produced by Cosmos Diagnostics:
{"Summary":{"DirectCalls":{"(200, 0)":2},"RegionsContacted":1},"name":"ReadItemAsync","id":"5bc711d2-4c7e-4669-bee1-29a478212b3d","start time":"09:28:59:779","duration in milliseconds":1.7632,"data":{"Client Configuration":{"Client Created Time Utc":"2022-05-12T19:46:44.1240365Z","MachineId":"hashedMachineName:6222fd05-5bb7-4b50-b8cd-0b34f8f9fcbf","NumberOfClientsCreated":1,"NumberOfActiveClients":1,"User Agent":"cosmos-netstandard-sdk/3.27.0|1|X64|Linux 5.4.0-1047-azure 49 18.|.NET Core 3.1.25|S|cdn","ConnectionConfig":{"gw":"(cps:50, urto:10, p:False, httpf: False)","rntbd":"(cto: 5, icto: -1, mrpc: 30, mcpe: 65535, erd: True, pr: ReuseUnicastPort)","other":"(ed:False, be:False)"},"ConsistencyConfig":"(consistency: NotSet, prgns:[])"},"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler","id":"5683454e-244a-4806-be54-5a26f68affd2","start time":"09:28:59:779","duration in milliseconds":1.6763,"children":[{"name":"XXXXX.CosmosDBStorageAdapter.Handlers.CosmosRetriableExceptionHandler","id":"8973df76-4464-44b8-811e-1ab9014b40df","start time":"09:28:59:779","duration in milliseconds":1.6658,"children":[{"name":"XXXXX.CosmosDBStorageAdapter.Handlers.CosmosCustomExceptionHandler","id":"c81248b7-aed6-46a4-86cd-0fc392a6cffa","start time":"09:28:59:779","duration in milliseconds":1.659,"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler","id":"1221f602-7978-4d21-b5a0-6408fb1948c5","start time":"09:28:59:779","duration in milliseconds":1.6208,"data":{"System Info":{"systemHistory":[{"dateUtc":"2022-05-12T21:27:25.2177017Z","cpu":46.520,"memory":5180428.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0048,"availableThreads":32766,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36},{"dateUtc":"2022-05-12T21:27:35.2184741Z","cpu":44.271,"memory":5169540.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0147,"availableThreads":32764,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36},{"dateUtc":"2022-05-12T21:27:45.2190887Z","cpu":40.572,"memory":5201132.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0146,"availableThreads":32765,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36},{"dateUtc":"2022-05-12T21:28:05.2187987Z","cpu":34.996,"memory":5178988.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.1526,"availableThreads":32764,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36},{"dateUtc":"2022-05-12T21:28:25.2200887Z","cpu":50.368,"memory":5184608.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.1561,"availableThreads":32765,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36},{"dateUtc":"2022-05-12T21:28:45.2190911Z","cpu":39.434,"memory":5174976.000,"threadInfo":{"isThreadStarving":"False","threadWaitIntervalInMs":0.0065,"availableThreads":32766,"minThreads":512,"maxThreads":32767},"numberOfOpenTcpConnection":36}]},"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RetryHandler","id":"923eb6c6-7e4d-46dc-8564-7847b2e3c89b","start time":"09:28:59:779","duration in milliseconds":1.6127,"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.RouterHandler","id":"10c4da3d-6a5d-4612-8447-690f133e6977","start time":"09:28:59:779","duration in milliseconds":1.6066,"children":[{"name":"Microsoft.Azure.Cosmos.Handlers.TransportHandler","id":"d0c0c757-980a-49f2-9ec1-39d14a059619","start time":"09:28:59:779","duration in milliseconds":1.6039,"children":[{"name":"Microsoft.Azure.Documents.ServerStoreModel Transport Request","id":"0c859596-d88e-46c9-b5a9-cecc4bb3ba00","start time":"09:28:59:779","duration in milliseconds":1.5617,"data":{"Client Side Request Stats":{"Id":"AggregatedClientSideRequestStatistics","ContactedReplicas":[{"Count":1,"Uri":"rntbd://XXXXXXX/apps/6b0c9ee4-d494-40da-bdcb-18de7329c427/services/9da4a1b5-b1e2-4e84-a183-bd8b2d492e7d/partitions/84082988-3f8a-4755-a2f6-38ece5baf7db/replicas/132918464629182379s/"},{"Count":1,"Uri":"rntbd://XXXXX/apps/6b0c9ee4-d494-40da-bdcb-18de7329c427/services/9da4a1b5-b1e2-4e84-a183-bd8b2d492e7d/partitions/84082988-3f8a-4755-a2f6-38ece5baf7db/replicas/132965881297119083s/"}],"RegionsContacted":["https://XXXXXX/"],"FailedReplicas":[],"AddressResolutionStatistics":[],"StoreResponseStatistics":[{"ResponseTimeUTC":"2022-05-12T21:28:59.7810307Z","ResourceType":"Document","OperationType":"Read","LocationEndpoint":"https://XXXXXXX/","StoreResult":{"ActivityId":"4ea1c20d-ecff-4fdd-a55e-a87d1bb73ef6","StatusCode":"Ok","SubStatusCode":"Unknown","LSN":238494,"PartitionKeyRangeId":"0","GlobalCommittedLSN":238494,"ItemLSN":165933,"UsingLocalLSN":false,"QuorumAckedLSN":-1,"SessionToken":"-1#238494","CurrentWriteQuorum":-1,"CurrentReplicaSetSize":-1,"NumberOfReadRegions":0,"IsValid":true,"StorePhysicalAddress":"rntbd://XXXXXX/apps/6b0c9ee4-d494-40da-bdcb-18de7329c427/services/9da4a1b5-b1e2-4e84-a183-bd8b2d492e7d/partitions/84082988-3f8a-4755-a2f6-38ece5baf7db/replicas/132918464629182379s/","RequestCharge":1.05,"RetryAfterInMs":null,"BELatencyInMs":"0.244","transportRequestTimeline":{"requestTimeline":[{"event": "Created", "startTimeUtc": "2022-05-12T21:28:59.7796018Z", "durationInMs": 0.0016},{"event": "ChannelAcquisitionStarted", "startTimeUtc": "2022-05-12T21:28:59.7796034Z", "durationInMs": 0.0017},{"event": "Pipelined", "startTimeUtc": "2022-05-12T21:28:59.7796051Z", "durationInMs": 0.0734},{"event": "Transit Time", "startTimeUtc": "2022-05-12T21:28:59.7796785Z", "durationInMs": 1.2775},{"event": "Received", "startTimeUtc": "2022-05-12T21:28:59.7809560Z", "durationInMs": 0.0731},{"event": "Completed", "startTimeUtc": "2022-05-12T21:28:59.7810291Z", "durationInMs": 0}],"serviceEndpointStats":{"inflightRequests":1,"openConnections":1},"connectionStats":{"waitforConnectionInit":"False","callsPendingReceive":0,"lastSendAttempt":"2022-05-12T21:28:59.7726968Z","lastSend":"2022-05-12T21:28:59.7727419Z","lastReceive":"2022-05-12T21:28:59.7737223Z"},"requestSizeInBytes":525,"responseMetadataSizeInBytes":434,"responseBodySizeInBytes":1240},"TransportException":null},{"ResponseTimeUTC":"2022-05-12T21:28:59.7810462Z","ResourceType":"Document","OperationType":"Read","LocationEndpoint":"XXXXX/","StoreResult":{"ActivityId":"4ea1c20d-ecff-4fdd-a55e-a87d1bb73ef6","StatusCode":"Ok","SubStatusCode":"Unknown","LSN":238494,"PartitionKeyRangeId":"0","GlobalCommittedLSN":238494,"ItemLSN":165933,"UsingLocalLSN":false,"QuorumAckedLSN":-1,"SessionToken":"-1#238494","CurrentWriteQuorum":-1,"CurrentReplicaSetSize":-1,"NumberOfReadRegions":0,"IsValid":true,"StorePhysicalAddress":"rntbd://XXXXXXXX/apps/6b0c9ee4-d494-40da-bdcb-18de7329c427/services/9da4a1b5-b1e2-4e84-a183-bd8b2d492e7d/partitions/84082988-3f8a-4755-a2f6-38ece5baf7db/replicas/132965881297119083s/","RequestCharge":1.05,"RetryAfterInMs":null,"BELatencyInMs":"0.325","transportRequestTimeline":{"requestTimeline":[{"event": "Created", "startTimeUtc": "2022-05-12T21:28:59.7796876Z", "durationInMs": 0.0016},{"event": "ChannelAcquisitionStarted", "startTimeUtc": "2022-05-12T21:28:59.7796892Z", "durationInMs": 0.0014},{"event": "Pipelined", "startTimeUtc": "2022-05-12T21:28:59.7796906Z", "durationInMs": 0.0646},{"event": "Transit Time", "startTimeUtc": "2022-05-12T21:28:59.7797552Z", "durationInMs": 1.2578},{"event": "Received", "startTimeUtc": "2022-05-12T21:28:59.7810130Z", "durationInMs": 0.0319},{"event": "Completed", "startTimeUtc": "2022-05-12T21:28:59.7810449Z", "durationInMs": 0}],"serviceEndpointStats":{"inflightRequests":1,"openConnections":1},"connectionStats":{"waitforConnectionInit":"False","callsPendingReceive":0,"lastSendAttempt":"2022-05-12T21:28:59.7763320Z","lastSend":"2022-05-12T21:28:59.7763798Z","lastReceive":"2022-05-12T21:28:59.7779676Z"},"requestSizeInBytes":525,"responseMetadataSizeInBytes":434,"responseBodySizeInBytes":1240},"TransportException":null}]}}]}]}]}]}]}]}]},{"name":"Response Serialization","id":"3e30a8de-8293-47af-b7c4-2915fa43b66d","start time":"09:28:59:781","duration in milliseconds":0.061}]}
Parse error on line 1:
...ortException":null},{"ResponseTimeUTC":"
-----------------------^
Expecting 'STRING', got '{'
To Reproduce I believe it always repro as long as you use the latest SDK.
Expected behavior JSON should be valid and able to be formatted.
Actual behavior
Parse error on line 1:
...ortException":null},{"ResponseTimeUTC":"
-----------------------^
Expecting 'STRING', got '{'
Environment summary SDK Version: 3.27.0 OS Version: Linux
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Troubleshoot Azure Cosmos DB bad request exceptions
A response with this error means the JSON document that is being sent to the service is lacking the required ID property. Solution....
Read more >Diagnosing Azure Cosmos DB in Production - Episode 70
They'll discuss how you can leverage the Diagnostics property in the Azure Cosmos DB for NoSQL Java SDK V4 so that you can...
Read more >Cosmos DB ReadNextAsync throwing JSON Serialization ...
I have checked that none of the records have id = 1. Full stack trace at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.AddReference ...
Read more >Deploy Diagnostic Settings for Cosmos DB to Log Analytics ...
Deploy-Diagnostics-CosmosDB - Deploys the diagnostic settings for Cosmos DB to stream to a Log Analytics workspace when any Cosmos DB which is missing...
Read more >Unexpected end of input was found in JSON content
"Datasource. Error: ODATA: Invalid Json. Unexpected end of input was found in JSON content. Not all objects and array scopes were closed. "....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@j82w we are not trying to parse it, we try to log the diagnostics once slow query happens and format the json to diagnose the root cause. It is not easy for us to read it in this case.
It is a producing a valid json for me in Linux with SDK version 3.27.0. But my generated json is slightly different from the given one as it is generated as a result of a different error.