{"action":"closed","issue":{"url":"https://api.github.com/repos/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/172","repository_url":"https://api.github.com/repos/Xabaril/AspNetCore.Diagnostics.HealthChecks","labels_url":"https://api.github.com/repos/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/172/labels{/name}","comments_url":"https://api.github.com/repos/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/172/comments","events_url":"https://api.github.com/repos/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/172/events","html_url":"https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/172","id":439243654,"node_id":"MDU6SXNzdWU0MzkyNDM2NTQ=","number":172,"title":"DocumentDb HealthCheck new-ing up DocumentClient per call","user":{"login":"ymitis","id":1269554,"node_id":"MDQ6VXNlcjEyNjk1NTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1269554?v=4","gravatar_id":"","url":"https://api.github.com/users/ymitis","html_url":"https://github.com/ymitis","followers_url":"https://api.github.com/users/ymitis/followers","following_url":"https://api.github.com/users/ymitis/following{/other_user}","gists_url":"https://api.github.com/users/ymitis/gists{/gist_id}","starred_url":"https://api.github.com/users/ymitis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ymitis/subscriptions","organizations_url":"https://api.github.com/users/ymitis/orgs","repos_url":"https://api.github.com/users/ymitis/repos","events_url":"https://api.github.com/users/ymitis/events{/privacy}","received_events_url":"https://api.github.com/users/ymitis/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-05-01T17:18:22Z","updated_at":"2019-05-02T09:27:05Z","closed_at":"2019-05-02T09:27:05Z","author_association":"NONE","body":"The [DocumentDbHealthCheck](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/src/HealthChecks.DocumentDb/DocumentDbHealthCheck.cs) creates a new instance of DocumentClient for each call to CheckHealthAsync.\r\n\r\n[Official Documentation](https://azure.microsoft.com/en-us/blog/performance-tips-for-azure-documentdb-part-1-2/) suggests using a Single instance of the DocumentClient per lifetime of the application.\r\n\r\n\r\n\r\n`\r\n\r\n            try\r\n            { \r\n                using (var documentDbClient = new DocumentClient(\r\n                    new Uri(_documentDbOptions.UriEndpoint),\r\n                    _documentDbOptions.PrimaryKey))\r\n                {\r\n                    await documentDbClient.OpenAsync(cancellationToken);\r\n                    return HealthCheckResult.Healthy();\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                return new HealthCheckResult(context.Registration.FailureStatus, exception: ex);\r\n            }\r\n`"}}
{"actor":{"display_login":"unaizorrilla"}}