Skip to content

Commit

Permalink
Added Mongo instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 committed Sep 20, 2023
1 parent ac2ac2a commit d7d80e8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SIL.DataAccess/IServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Action<IMongoDataAccessConfigurator> configure
services.Configure<MongoDataAccessOptions>(options => options.Url = new MongoUrl(connectionString));
services.AddTransient<SIL.DataAccess.IIdGenerator, ObjectIdGenerator>();
var clientSettings = MongoClientSettings.FromConnectionString(connectionString);
clientSettings.ClusterConfigurator = cb => cb.Subscribe(new DiagnosticsActivityEventSubscriber());
clientSettings.LinqProvider = LinqProvider.V2;
services.AddSingleton<IMongoClient>(sp => new MongoClient(clientSettings));
services.AddSingleton(
Expand Down
1 change: 1 addition & 0 deletions src/SIL.DataAccess/SIL.DataAccess.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="MongoDB.Driver" Version="2.20.0" />
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="1.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
<PackageReference Include="SIL.Core" Version="12.0.1" />
Expand Down
1 change: 1 addition & 0 deletions src/SIL.DataAccess/Usings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
global using MongoDB.Bson.Serialization;
global using MongoDB.Bson.Serialization.Conventions;
global using MongoDB.Bson.Serialization.Serializers;
global using MongoDB.Driver.Core.Extensions.DiagnosticSources;
global using MongoDB.Driver;
global using MongoDB.Driver.Linq;
global using Nito.AsyncEx;
Expand Down
1 change: 1 addition & 0 deletions src/Serval.ApiServer/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void ConfigureServices(IServiceCollection services)
{
builder.AddAspNetCoreInstrumentation().AddConsoleExporter();
builder.AddHttpClientInstrumentation().AddConsoleExporter();
builder.AddSource("MongoDB.Driver.Core.Extensions.DiagnosticSources").AddConsoleExporter();
});
}

Expand Down

0 comments on commit d7d80e8

Please sign in to comment.