-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CosmosDiagnostics: Add active client count #2589
Comments
We need to think about scenarios where the customer is doing:
If this is executed concurrently and in high numbers it is still a bad scenario, the number of clients created would be high and the fact that the active clients might be low doesn't mean everything is correct. |
There will be a TotalNumberOfClientsCreated and a ActiveNumberOfClientsCreated. If there is some crazy number of total clients it will still be obvious. The active number will tell if the user is disposing of the client or has N clients active. It may also help in scenarios where users think they are disposing of the clients but are not. |
In our scenario we are having the clients in cache where they are removed after a certain time being unused, so we would be creating and deleting them often. |
There are genuine scenarios to create multiple clients (ex: multiple accounts). The data needs to dis-ambiguate or at-least have right semantics of interpretation. One option is to have normalized counter like per account #clients (MAX) |
For troubleshooting I think having a total active count is sufficient. It doesn't matter if they have 100 SDK instances with 100 different accounts vs 100 SDK instance for the same account. Both will run into the same issue of causing to many connections. |
We are currently tracking total number of active clients globally, not per account, if that helps as a data point. |
Recommendation is: Customer should have 1 Client Instance per Account. if User have multiple accounts, then there is no other way except creating multiple client instances. So We should collect how many clients is being created per account. E.g. Customer have 10 accounts and then |
UserAgent do already cover some aspects of it. Or if the # createdClients is not relevant why not change to activeClients in userAgent? |
The number of created clients is more important than number of active clients. The number of created clients tells if the application is creating multiple instances or recreating instances. If just the number of active instances is recorded it will not be possible to tell if the customer is recreating instance for each call. This is the most common issue observed. The problem with just capturing total number of clients created is there are scenarios where customers by design recreates instances. This usually occurs is middle tier services where the customer is reselling Cosmos DB. In those scenarios it's not possible to tell how many active clients instance exist. The process having 2 active clients vs 200 is a big difference, and can be helpful in root causing certain issues. |
The diagnostics currently only has the number of created clients. This issue is to track adding the number of active clients. This way we can see if a user is properly disposing of clients for certain cases.
The text was updated successfully, but these errors were encountered: