Skip to content

feat: add mongodb configuration overloads#2121

Merged
adamsitnik merged 8 commits intoXabaril:masterfrom
ailtonguitar:feature/create-mongodb-overloads
Jan 24, 2024
Merged

feat: add mongodb configuration overloads#2121
adamsitnik merged 8 commits intoXabaril:masterfrom
ailtonguitar:feature/create-mongodb-overloads

Conversation

@ailtonguitar
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Copy link
Copy Markdown
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
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 61.90476% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.39%. Comparing base (66eac5a) to head (e275cb6).
⚠️ Report is 100 commits behind head on master.

Files with missing lines 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 0.00% <61.90%> (-28.87%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

4 participants