Hi @MikeM-8643,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I'm glad to help you with your questions.
_logger is private class property created by an injected ILoggerFactory. The logging statements in the ContinueWith do not appear in AppInsights. The Console.WriteLine statements do appear. Should the logger work in a ContinueWith?
The logger should work in a ContinueWith block, but there are a few things to check:
- Ensure the logger is properly initialized and accessible within the ContinueWith scope.
- Verify that the logging level is set appropriately to capture the logs.
- Check if there are any exceptions or issues within the ContinueWith block that might prevent logging.
Should I be using something other than TaskContinueOptions.None?
Using TaskContinueOptions.None is generally fine, but you might want to consider TaskContinuationOptions.ExecuteSynchronously if you need the continuation to run on the same thread.
I could not find a Cosmos DB RU rate limiter, did I miss something?
Cosmos DB does not have a built-in rate limiter, but you can implement your own rate limiting mechanism. This involves profiling your application, defining indexes, and spreading requests over time to avoid exceeding the provisioned throughput.
The documentation states that 429 errors have automatic retry and will often complete. How do I trap what eventually completed and what did not?
To trap what eventually completed and what did not, you can use the ResponseDiagnostics feature in the Cosmos DB SDK. This allows you to log detailed information about each request, including retries and final outcomes.
You can also implement custom retry logic to track and log the status of each request.
Code like this is used in many repositories. Do I have to write custom code to determine the average RU/write depending on the repository, then send tasks in batches that will not exceed 5,000 RU/sec?
Yes, you might need to write custom code to determine the average RU per write operation. This involves profiling your application and monitoring the RU consumption for different operations.
Sending tasks in batches that do not exceed 5,000 RU/sec can be managed by implementing a rate limiting mechanism.
For more information, please refer the documents:
https://learn.microsoft.com/en-us/azure/cosmos-db/rate-limiting-requests
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.