Skip to content

feat: Add support for MongoDB.Driver 3.x and above. #3065

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

Merged
merged 4 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions build/Dotty/packageInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@
"packageName": "microsoft.net.http"
},
{
"packageName": "mongodb.driver",
"ignorePatch": true,
"ignoreMinor": true,
"ignoreMajor": true,
"ignoreReason": "Breaking since at least 2.25.0. See https://new-relic.atlassian.net/browse/NR-281915"
"packageName": "mongodb.driver"
},
{
"packageName": "mysql.data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SPDX-License-Identifier: Apache-2.0
-->
<extension xmlns="urn:newrelic-extension">
<instrumentation>

<tracerFactory name="MongoCollectionImplWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoCollectionImpl`1">
<exactMethodMatcher methodName="AggregateAsync"/>
Expand Down Expand Up @@ -37,86 +38,115 @@ SPDX-License-Identifier: Apache-2.0
</match>
</tracerFactory>

<tracerFactory name="AsyncCursorWrapper">
<match assemblyName="MongoDB.Driver.Core" className="MongoDB.Driver.Core.Operations.AsyncCursor`1">
<exactMethodMatcher methodName="GetNextBatch"/>
<exactMethodMatcher methodName="GetNextBatchAsync"/>
</match>
</tracerFactory>
<tracerFactory name="AsyncCursorWrapper">
<match assemblyName="MongoDB.Driver.Core" className="MongoDB.Driver.Core.Operations.AsyncCursor`1" maxVersion="3.0.0">
<exactMethodMatcher methodName="GetNextBatch"/>
<exactMethodMatcher methodName="GetNextBatchAsync"/>
</match>

<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.Core.Operations.AsyncCursor`1" minVersion="3.0.0">
<exactMethodMatcher methodName="GetNextBatch"/>
<exactMethodMatcher methodName="GetNextBatchAsync"/>
</match>
</tracerFactory>

<tracerFactory name="MongoDatabaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoDatabaseImpl">
<exactMethodMatcher methodName="Aggregate"/>
<exactMethodMatcher methodName="AggregateToCollection"/>
<exactMethodMatcher methodName="CreateCollection"/>
<exactMethodMatcher methodName="CreateView"/>
<exactMethodMatcher methodName="DropCollection"/>
<exactMethodMatcher methodName="ListCollections"/>
<exactMethodMatcher methodName="ListCollectionNames"/>
<exactMethodMatcher methodName="RenameCollection"/>
<exactMethodMatcher methodName="RunCommand"/>
<exactMethodMatcher methodName="Watch"/>
<tracerFactory name="MongoDatabaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoDatabaseImpl" maxVersion="3.0.0">
<exactMethodMatcher methodName="Aggregate"/>
<exactMethodMatcher methodName="AggregateToCollection"/>
<exactMethodMatcher methodName="CreateCollection"/>
<exactMethodMatcher methodName="CreateView"/>
<exactMethodMatcher methodName="DropCollection"/>
<exactMethodMatcher methodName="ListCollections"/>
<exactMethodMatcher methodName="ListCollectionNames"/>
<exactMethodMatcher methodName="RenameCollection"/>
<exactMethodMatcher methodName="RunCommand"/>
<exactMethodMatcher methodName="Watch"/>

<exactMethodMatcher methodName="AggregateAsync"/>
<exactMethodMatcher methodName="AggregateToCollectionAsync"/>
<exactMethodMatcher methodName="CreateCollectionAsync"/>
<exactMethodMatcher methodName="CreateViewAsync"/>
<exactMethodMatcher methodName="DropCollectionAsync"/>
<exactMethodMatcher methodName="ListCollectionsAsync"/>
<exactMethodMatcher methodName="ListCollectionNamesAsync"/>
<exactMethodMatcher methodName="RenameCollectionAsync"/>
<exactMethodMatcher methodName="RunCommandAsync"/>
<exactMethodMatcher methodName="WatchAsync"/>
</match>

<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoDatabase" minVersion="3.0.0">
<exactMethodMatcher methodName="Aggregate"/>
<exactMethodMatcher methodName="AggregateToCollection"/>
<exactMethodMatcher methodName="CreateCollection"/>
<exactMethodMatcher methodName="CreateView"/>
<exactMethodMatcher methodName="DropCollection"/>
<exactMethodMatcher methodName="ListCollections"/>
<exactMethodMatcher methodName="ListCollectionNames"/>
<exactMethodMatcher methodName="RenameCollection"/>
<exactMethodMatcher methodName="RunCommand"/>
<exactMethodMatcher methodName="Watch"/>

<exactMethodMatcher methodName="AggregateAsync"/>
<exactMethodMatcher methodName="AggregateToCollectionAsync"/>
<exactMethodMatcher methodName="CreateCollectionAsync"/>
<exactMethodMatcher methodName="CreateViewAsync"/>
<exactMethodMatcher methodName="DropCollectionAsync"/>
<exactMethodMatcher methodName="ListCollectionsAsync"/>
<exactMethodMatcher methodName="ListCollectionNamesAsync"/>
<exactMethodMatcher methodName="RenameCollectionAsync"/>
<exactMethodMatcher methodName="RunCommandAsync"/>
<exactMethodMatcher methodName="WatchAsync"/>
</match>
</tracerFactory>
<exactMethodMatcher methodName="AggregateAsync"/>
<exactMethodMatcher methodName="AggregateToCollectionAsync"/>
<exactMethodMatcher methodName="CreateCollectionAsync"/>
<exactMethodMatcher methodName="CreateViewAsync"/>
<exactMethodMatcher methodName="DropCollectionAsync"/>
<exactMethodMatcher methodName="ListCollectionsAsync"/>
<exactMethodMatcher methodName="ListCollectionNamesAsync"/>
<exactMethodMatcher methodName="RenameCollectionAsync"/>
<exactMethodMatcher methodName="RunCommandAsync"/>
<exactMethodMatcher methodName="WatchAsync"/>
</match>
</tracerFactory>

<tracerFactory name="MongoQueryProviderImplWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.Linq.MongoQueryProviderImpl`1">
<exactMethodMatcher methodName="ExecuteModel"/>
<exactMethodMatcher methodName="ExecuteModelAsync"/>
</match>
</tracerFactory>
<tracerFactory name="MongoQueryProviderImplWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.Linq.MongoQueryProviderImpl`1">
<exactMethodMatcher methodName="ExecuteModel"/>
<exactMethodMatcher methodName="ExecuteModelAsync"/>
</match>
</tracerFactory>

<tracerFactory name="MongoIndexManagerBaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoIndexManagerBase`1">
<exactMethodMatcher methodName="CreateOne"/>
<exactMethodMatcher methodName="CreateOneAsync"/>
</match>
</tracerFactory>
<tracerFactory name="MongoIndexManagerBaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoIndexManagerBase`1">
<exactMethodMatcher methodName="CreateOne"/>
<exactMethodMatcher methodName="CreateOneAsync"/>
</match>
</tracerFactory>

<tracerFactory name="MongoIndexManagerWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoCollectionImpl`1+MongoIndexManager">
<exactMethodMatcher methodName="CreateMany"/>
<exactMethodMatcher methodName="DropAll"/>
<exactMethodMatcher methodName="DropOne"/>
<exactMethodMatcher methodName="List"/>
<tracerFactory name="MongoIndexManagerWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoCollectionImpl`1+MongoIndexManager">
<exactMethodMatcher methodName="CreateMany"/>
<exactMethodMatcher methodName="DropAll"/>
<exactMethodMatcher methodName="DropOne"/>
<exactMethodMatcher methodName="List"/>

<exactMethodMatcher methodName="CreateManyAsync"/>
<exactMethodMatcher methodName="DropAllAsync"/>
<exactMethodMatcher methodName="DropOneAsync"/>
<exactMethodMatcher methodName="ListAsync"/>
</match>
</tracerFactory>
<exactMethodMatcher methodName="CreateManyAsync"/>
<exactMethodMatcher methodName="DropAllAsync"/>
<exactMethodMatcher methodName="DropOneAsync"/>
<exactMethodMatcher methodName="ListAsync"/>
</match>
</tracerFactory>

<tracerFactory name="MongoCollectionBaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoCollectionBase`1">
<exactMethodMatcher methodName="DeleteMany"/>
<exactMethodMatcher methodName="DeleteOne"/>
<exactMethodMatcher methodName="InsertOne"/>
<exactMethodMatcher methodName="InsertMany"/>
<exactMethodMatcher methodName="ReplaceOne"/>
<exactMethodMatcher methodName="UpdateMany"/>
<exactMethodMatcher methodName="UpdateOne"/>
<tracerFactory name="MongoCollectionBaseWrapper">
<match assemblyName="MongoDB.Driver" className="MongoDB.Driver.MongoCollectionBase`1">
<exactMethodMatcher methodName="DeleteMany"/>
<exactMethodMatcher methodName="DeleteOne"/>
<exactMethodMatcher methodName="InsertOne"/>
<exactMethodMatcher methodName="InsertMany"/>
<exactMethodMatcher methodName="ReplaceOne"/>
<exactMethodMatcher methodName="UpdateMany"/>
<exactMethodMatcher methodName="UpdateOne"/>

<exactMethodMatcher methodName="DeleteManyAsync"/>
<exactMethodMatcher methodName="DeleteOneAsync"/>
<exactMethodMatcher methodName="InsertOneAsync"/>
<exactMethodMatcher methodName="InsertManyAsync"/>
<exactMethodMatcher methodName="ReplaceOneAsync"/>
<exactMethodMatcher methodName="UpdateManyAsync"/>
<exactMethodMatcher methodName="UpdateOneAsync"/>
</match>
</tracerFactory>
<exactMethodMatcher methodName="DeleteManyAsync"/>
<exactMethodMatcher methodName="DeleteOneAsync"/>
<exactMethodMatcher methodName="InsertOneAsync"/>
<exactMethodMatcher methodName="InsertManyAsync"/>
<exactMethodMatcher methodName="ReplaceOneAsync"/>
<exactMethodMatcher methodName="UpdateManyAsync"/>
<exactMethodMatcher methodName="UpdateOneAsync"/>
</match>
</tracerFactory>

</instrumentation>
</extension>
Loading
Loading