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

Add support for MongoDB.Driver version 3 #2324

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

eerhardt
Copy link
Collaborator

@eerhardt eerhardt commented Nov 25, 2024

MongoDB.Driver version 3 made a major breaking change by removing the MongoDB.Driver.Core assembly.

Handle this breaking change by splitting our package into 2, one for each major version.

1. For the current HealthChecks.MongoDb package, we put a NuGet version limit on our dependency: [2.28.0,3.0.0). This way people won't be able to update to the 3.0.0 version, which will break their app.
2. We add a new, forked component named HealthChecks.MongoDb.v3 which will have a dependency on 3.0.0 and contains updates so the health checks will work with v3. People who explicitly want to use version 3 can opt into using this package.
3. When the next major version of HealthChecks ships, we can "swap" the dependencies around. The HealthChecks.MongoDb package will be updated to depend on version 3 of MongoDB.Driver. If MongoDB.Driver v2.x is still in support, we can create HeatlhChecks.MongoDb.v2 which has the dependency limit [2.28.0,3.0.0) and works with the version 2 of MongoDB.Driver. HealthChecks.MongoDb.v3 will be dead-ended.

Similar changes as Add support for RabbitMQ.Client version 7. (Xabaril/AspNetCore.Diagnostics.HealthChecks#2323).

Handle this breaking change by updating to the new v3 version in HealthChecks v9.x release. According to https://www.mongodb.com/community/forums/t/net-driver-2-30-0-released/301201, MongoDB.Driver v2.x will no longer be supported:

Version 2.30.0 of the driver is the last scheduled 2.x release. Further driver development will continue in 3.x versions.

Because of this, the HealthChecks should only need to support v3+ going forward. If someone needs to use the v2.x version, they can continue to use AspNetCore.HealthChecks.MongoDb v8.x.

Fix #2322

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

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.28.0" />
<PackageReference Include="MongoDB.Driver" Version="[2.28.0,3.0.0)" />

Choose a reason for hiding this comment

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

Should this be 2.30.0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Check the top comment. This is outdated now. We will only support the 3+ version going forward.

… MongoDB.Driver.Core assembly.

Handle this breaking change by splitting our package into 2, one for each major version.

1. For the current HealthChecks.MongoDb package, we put a NuGet version limit on our dependency: [2.28.0,3.0.0). This way people won't be able to update to the 3.0.0 version, which will break their app.
2. We add a new, forked component named HealthChecks.MongoDb.v3 which will have a dependency on 3.0.0 and contains updates so the health checks will work with v3. People who explicitly want to use version 3 can opt into using this package.
3. When the next major version of HealthChecks ships, we can "swap" the dependencies around. The HealthChecks.MongoDb package will be updated to depend on version 3 of MongoDB.Driver. If MongoDB.Driver v2.x is still in support, we can create HeatlhChecks.MongoDb.v2 which has the dependency limit [2.28.0,3.0.0) and works with the version 2 of MongoDB.Driver. HealthChecks.MongoDb.v3 will be dead-ended.

Fix Xabaril#2322
@codecov-commenter
Copy link

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

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.32%. Comparing base (72d9abf) to head (14e7d9d).
Report is 5 commits behind head on master.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2324      +/-   ##
==========================================
- Coverage   66.88%   66.32%   -0.56%     
==========================================
  Files         268      254      -14     
  Lines        8730     8571     -159     
  Branches      631      613      -18     
==========================================
- Hits         5839     5685     -154     
+ Misses       2723     2722       -1     
+ Partials      168      164       -4     
Flag Coverage Δ
ApplicationStatus 28.67% <ø> (ø)
ArangoDb 28.30% <ø> (ø)
Aws.S3 15.52% <ø> (ø)
Aws.SecretsManager 15.82% <ø> (ø)
Aws.Sns 15.97% <ø> (ø)
Aws.Sqs 16.66% <ø> (ø)
Aws.SystemsManager 15.82% <ø> (ø)
Azure.IoTHub 13.82% <ø> (ø)
AzureApplicationInsights 16.56% <ø> (ø)
AzureBlobStorage ?
AzureDigitalTwin 37.15% <ø> (ø)
AzureEventHubs ?
AzureFileStorage ?
AzureKeyVault 30.48% <ø> (ø)
AzureQueueStorage ?
AzureSearch 17.60% <ø> (ø)
AzureServiceBus 72.48% <ø> (ø)
AzureTableStorage ?
Consul 24.32% <ø> (ø)
CosmosDb 29.45% <ø> (ø)
Dapr 14.50% <ø> (ø)
DynamoDb 13.29% <ø> (ø)
Elasticsearch 47.66% <ø> (ø)
EventStore 65.14% <ø> (ø)
EventStore.gRPC 25.51% <ø> (ø)
Gcp.CloudFirestore 13.33% <ø> (ø)
Gremlin 25.00% <ø> (ø)
Hangfire 12.10% <ø> (ø)
IbmMQ 30.76% <ø> (ø)
InfluxDB 15.54% <ø> (ø)
Kafka 23.52% <ø> (ø)
Kubernetes 41.54% <ø> (ø)
Milvus 16.78% <ø> (ø)
MongoDb 32.85% <ø> (ø)
MySql 33.33% <ø> (ø)
Nats 72.77% <ø> (ø)
Npgsql 44.22% <ø> (ø)
OpenIdConnectServer 42.48% <ø> (ø)
Oracle 63.92% <ø> (ø)
Prometheus.Metrics 29.80% <ø> (ø)
Publisher.ApplicationInsights 15.27% <ø> (ø)
Publisher.CloudWatch 20.33% <ø> (ø)
Publisher.Datadog 17.19% <ø> (ø)
Publisher.Prometheus 18.75% <ø> (ø)
Publisher.Seq 40.74% <ø> (ø)
Qdrant 18.25% <ø> (ø)
RabbitMQ 50.63% <ø> (ø)
RavenDb 73.42% <ø> (ø)
Redis 68.47% <ø> (ø)
SendGrid 17.21% <ø> (ø)
SignalR 25.97% <ø> (ø)
SqlServer 30.43% <ø> (ø)
Sqlite 25.88% <ø> (ø)
System 43.58% <ø> (ø)
UI 65.84% <ø> (-0.03%) ⬇️
Uris 62.14% <ø> (ø)

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.

src/CallerArgumentExpressionAttribute.cs Show resolved Hide resolved
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(DefaultLibraryTargetFrameworks)</TargetFrameworks>
<!-- Match the TFMs of MongoDB.Driver -->
<TargetFrameworks>$(DefaultNetCoreApp);netstandard2.1;net472</TargetFrameworks>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we should simply drop the NS support?

Suggested change
<TargetFrameworks>$(DefaultNetCoreApp);netstandard2.1;net472</TargetFrameworks>
<TargetFrameworks>$(DefaultNetCoreApp);net472</TargetFrameworks>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since the underlying MongoDB.Driver library supports netstandard2.1, I feel like the health check library should as well. It would be a pity to block someone for no reason.

For example, I think Unity supports netstandard2.1 - https://docs.unity3d.com/6000.0/Documentation/Manual/dotnet-profile-support.html

@eerhardt
Copy link
Collaborator Author

eerhardt commented Dec 4, 2024

@adamsitnik - I believe this is ready for re-review. I have addressed all the feedback.

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 @eerhardt !

@adamsitnik adamsitnik merged commit 4d36f82 into Xabaril:master Dec 5, 2024
55 checks passed
@adamsitnik adamsitnik added this to the 9.0 milestone Dec 5, 2024
@Kiechlus
Copy link

Kiechlus commented Dec 6, 2024

Thanks a lot everyone! @adamsitnik, is it possible to estimate when this will be available as nuget package. Or can we somehow get the preview package?

Background, we have a release coming and need to get our MongoDb health checks green, the one way or the other.

@adamsitnik
Copy link
Collaborator

is it possible to estimate when this will be available as nuget package

I am aiming for next week, but it depends on the availability of @unaizorrilla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility issue with MongoDB.Driver 3.0.0
5 participants