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.

Request Latency is missing in v3 responses

See original GitHub issue

Is your feature request related to a problem? Please describe. In v2 of the library, responses had a RequestLatency field which showed the latency of the raw request against Cosmos DB. In v3, it seems that this field is no longer available. I see that internally, the library is storing this value within the specific CosmosDiagnostics class for each response type, but it’s not publicly accessible without deserializing through CosmosDiagnostics.ToString(), which is not a performant or efficient solution.

Describe the solution you’d like The Response<'T> type should expose the RequestLatency value, or else provide an easily consumable form of CosmosDiagnostics that is not internal.

Describe alternatives you’ve considered Deserializing the CosmosDiagnostics.ToString(), but the cost to do this for every single request is too heavy.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ealsurcommented, Oct 4, 2019

@ylibrach You can get the required statistics for Autoscale from Azure Monitor: https://docs.microsoft.com/en-us/azure/cosmos-db/logging#interpret which can be read programmatically to generate an autoscale logic.

I have trouble understanding point # 1. RequestLatency is the time it takes for the request to go from the origin and get back, if there is a network blip or your connections/sockets are starved, that latency will be affected. How is that related to RU consumption and self throttling? That seems to be related to RequestCharge.

0reactions
ylibrachcommented, Oct 2, 2019

Based on the description it sounds like the application is doing the scaling. The better design here is to log the information and have a separate application relying on telemetry to do the scaling. This way the container can be scaled with multiple application instances.

We actually have both:

  1. The individual microservices are throttling themselves (max parallelization) based on their own single-thread RU/s consumed over the past several minutes (this is where Request Latency comes into play), compared to total RU consumed by all microservices against a specific collection. This prevents us from sending too many requests against Cosmos and getting tons of 429’s before the collection has a chance to be scaled up to the necessary throughput.
  2. There is a separate dedicated autoscaler microservice which monitors the total aggregate RUs hitting each collection across all microservices, and makes throughput adjustments for the collections accordingly.
Read more comments on GitHub >

github_iconTop Results From Across the Web

API Gateway responding with a status of 0, Integration ...
I just looked through all of my "Options" endpoints in API gateway (which is what's used for CORS) and none of them require...
Read more >
Troubleshoot high latency on a DynamoDB table
I'm seeing an increase in the response time for Amazon DynamoDB requests. Resolution. To troubleshoot high latency on your DynamoDB table, analyze the...
Read more >
Error handling with DynamoDB - AWS Documentation
Discover the best practices for handling client and server errors and exceptions returned by Amazon DynamoDB operations.
Read more >
CloudWatch metrics for your Classic Load Balancer
Elastic Load Balancing reports metrics to CloudWatch only when requests are flowing ... are experiencing high latency and are slow to respond to...
Read more >
Error Responses | Analytics Provisioning API
If an error occurs with a request, the API returns an HTTP status code, status, and reason in the response based on the...
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