Skip to content
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

feat: add mongodb configuration overloads #2121

Merged

Conversation

ailtonguitar
Copy link
Contributor

What this PR does / why we need it:
Adds new overloads to mongodb health check, it is necessary to give support for reusing mongoclient and mongoclientsetting instances from the container and take advantage of advanced configurations like tracing and metrics.

Does this PR introduce a user-facing change?:
No

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Unit tests passing
  • End-to-end tests passing
  • Extended the documentation
  • Provided sample for the feature

@ailtonguitar
Copy link
Contributor Author

Can we move forward with this PR? Is something missing here?

Copy link
Collaborator

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution.

@unaizorrilla @sungam3r @adamsitnik - any thoughts here?

Copy link
Collaborator

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @ailtonguitar ! PTAL at my feedback

public MongoDbHealthCheck(IMongoClient client, string? databaseName = default)
: this(client.Settings, databaseName)
{
_mongoClient[_mongoClientSettings.ToString()] = client;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this cache, but this is outside of the scope of this PR. I've created #2148 to track it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @adamsitnik! Since it is not part of the scope of this PR can we close this one?

ailtonguitar and others added 2 commits January 24, 2024 10:49
…kBuilderExtensions.cs

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
…kBuilderExtensions.cs

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Copy link
Collaborator

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are almost there. Please update this file with the new APIs that you are introducing in this PR: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt

IIRC you should be able to run these particular tests locally

@ailtonguitar
Copy link
Contributor Author

We are almost there. Please update this file with the new APIs that you are introducing in this PR: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/test/HealthChecks.MongoDb.Tests/HealthChecks.MongoDb.approved.txt

IIRC you should be able to run these particular tests locally

Hi @adamsitnik! Done, please review.

@codecov-commenter
Copy link

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (66eac5a) 64.77% compared to head (e275cb6) 64.39%.
Report is 7 commits behind head on master.

Files Patch % Lines
...cyInjection/MongoDbHealthCheckBuilderExtensions.cs 50.00% 8 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2121      +/-   ##
==========================================
- Coverage   64.77%   64.39%   -0.38%     
==========================================
  Files         258      248      -10     
  Lines        8479     8383      -96     
  Branches      599      587      -12     
==========================================
- Hits         5492     5398      -94     
- Misses       2836     2838       +2     
+ Partials      151      147       -4     
Flag Coverage Δ
AzureEventHubs ?
AzureQueueStorage ?
AzureTableStorage ?
Dapr ?
MongoDb 31.77% <61.90%> (+2.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution @ailtonguitar !

@adamsitnik adamsitnik merged commit 73abc7a into Xabaril:master Jan 24, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants