Skip to content

Commit

Permalink
Add Azure Service Bus to NetCoreAll
Browse files Browse the repository at this point in the history
  • Loading branch information
russcam committed Mar 25, 2021
1 parent 1cfac4e commit 995f266
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
21 changes: 17 additions & 4 deletions src/Elastic.Apm.NetCoreAll/ApmMiddlewareExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using Elastic.Apm.Azure.ServiceBus;
using Elastic.Apm.DiagnosticSource;
using Elastic.Apm.Elasticsearch;
using Elastic.Apm.EntityFrameworkCore;
Expand All @@ -15,8 +16,14 @@ namespace Elastic.Apm.NetCoreAll
public static class ApmMiddlewareExtension
{
/// <summary>
/// Adds the Elastic APM Middleware to the ASP.NET Core pipeline and enables <see cref="HttpDiagnosticsSubscriber" />,
/// <see cref="EfCoreDiagnosticsSubscriber" />, and <see cref="SqlClientDiagnosticSubscriber"/>.
/// Adds the Elastic APM Middleware to the ASP.NET Core pipeline and enables
/// <see cref="HttpDiagnosticsSubscriber" />,
/// <see cref="EfCoreDiagnosticsSubscriber" />,
/// <see cref="SqlClientDiagnosticSubscriber"/>,
/// <see cref="ElasticsearchDiagnosticsSubscriber"/>.
/// <see cref="GrpcClientDiagnosticSubscriber"/>,
/// <see cref="AzureMessagingServiceBusDiagnosticsSubscriber"/>,
/// and <see cref="MicrosoftAzureServiceBusDiagnosticsSubscriber"/>
/// This method turns on ASP.NET Core monitoring with every other related monitoring components, for example the agent
/// will also automatically trace outgoing HTTP requests and database statements.
/// </summary>
Expand All @@ -31,7 +38,13 @@ public static IApplicationBuilder UseAllElasticApm(
this IApplicationBuilder builder,
IConfiguration configuration = null
) => AspNetCore.ApmMiddlewareExtension
.UseElasticApm(builder, configuration, new HttpDiagnosticsSubscriber(), new EfCoreDiagnosticsSubscriber(),
new SqlClientDiagnosticSubscriber(), new ElasticsearchDiagnosticsSubscriber(), new GrpcClientDiagnosticSubscriber());
.UseElasticApm(builder, configuration,
new HttpDiagnosticsSubscriber(),
new EfCoreDiagnosticsSubscriber(),
new SqlClientDiagnosticSubscriber(),
new ElasticsearchDiagnosticsSubscriber(),
new GrpcClientDiagnosticSubscriber(),
new AzureMessagingServiceBusDiagnosticsSubscriber(),
new MicrosoftAzureServiceBusDiagnosticsSubscriber());
}
}
1 change: 1 addition & 0 deletions src/Elastic.Apm.NetCoreAll/Elastic.Apm.NetCoreAll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ProjectReference Include="..\Elastic.Apm.EntityFrameworkCore\Elastic.Apm.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Elastic.Apm.GrpcClient\Elastic.Apm.GrpcClient.csproj" />
<ProjectReference Include="..\Elastic.Apm.SqlClient\Elastic.Apm.SqlClient.csproj" />
<ProjectReference Include="..\Elastic.Apm.Azure.ServiceBus\Elastic.Apm.Azure.ServiceBus.csproj" />
<ProjectReference Include="..\Elastic.Apm\Elastic.Apm.csproj" />
</ItemGroup>
</Project>
19 changes: 15 additions & 4 deletions src/Elastic.Apm.NetCoreAll/HostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// See the LICENSE file in the project root for more information

using Elastic.Apm.AspNetCore.DiagnosticListener;
using Elastic.Apm.Azure.ServiceBus;
using Elastic.Apm.DiagnosticSource;
using Elastic.Apm.Elasticsearch;
using Elastic.Apm.EntityFrameworkCore;
Expand All @@ -17,15 +18,25 @@ namespace Elastic.Apm.NetCoreAll
public static class HostBuilderExtensions
{
/// <summary>
/// Register Elastic APM .NET Agent with components in the container and enables <see cref="HttpDiagnosticsSubscriber" />,
/// <see cref="EfCoreDiagnosticsSubscriber" />, and <see cref="SqlClientDiagnosticSubscriber"/>.
/// Register Elastic APM .NET Agent with components in the container and enables
/// <see cref="HttpDiagnosticsSubscriber" />,
/// <see cref="AspNetCoreDiagnosticSubscriber" />,
/// <see cref="EfCoreDiagnosticsSubscriber" />,
/// <see cref="SqlClientDiagnosticSubscriber"/>,
/// <see cref="ElasticsearchDiagnosticsSubscriber"/>.
/// <see cref="GrpcClientDiagnosticSubscriber"/>,
/// <see cref="AzureMessagingServiceBusDiagnosticsSubscriber"/>,
/// and <see cref="MicrosoftAzureServiceBusDiagnosticsSubscriber"/>
/// </summary>
/// <param name="builder">Builder.</param>
public static IHostBuilder UseAllElasticApm(this IHostBuilder builder) => builder.UseElasticApm(new HttpDiagnosticsSubscriber(),
public static IHostBuilder UseAllElasticApm(this IHostBuilder builder) => builder.UseElasticApm(
new HttpDiagnosticsSubscriber(),
new AspNetCoreDiagnosticSubscriber(),
new EfCoreDiagnosticsSubscriber(),
new SqlClientDiagnosticSubscriber(),
new ElasticsearchDiagnosticsSubscriber(),
new GrpcClientDiagnosticSubscriber());
new GrpcClientDiagnosticSubscriber(),
new AzureMessagingServiceBusDiagnosticsSubscriber(),
new MicrosoftAzureServiceBusDiagnosticsSubscriber());
}
}

0 comments on commit 995f266

Please sign in to comment.