Skip to content

Commit 3c61624

Browse files
committed
Add FastEndpoints OpenTelemetry
1 parent bce2bc2 commit 3c61624

35 files changed

+2239
-264
lines changed

FastEndpoints.Extensions.All.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastEndpoints.ApiExplorer",
66
EndProject
77
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web", "sample\Web\Web.csproj", "{A5D85B37-27D5-416D-BFE6-686BEB5611DE}"
88
EndProject
9-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastEndpoints.DiagnosticSources", "src\FastEndpoints.DiagnosticSources\FastEndpoints.DiagnosticSources.csproj", "{0EA54DD8-1A1B-4DEF-A085-01C648595FC6}"
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastEndpoints.OpenTelemetry", "src\FastEndpoints.OpenTelemetry\FastEndpoints.OpenTelemetry.csproj", "{0EA54DD8-1A1B-4DEF-A085-01C648595FC6}"
1010
EndProject
1111
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastEndpoints.Reflection", "src\FastEndpoints.Reflection\FastEndpoints.Reflection.csproj", "{BACCE356-2989-42EF-AE76-3C1A59D4DEFB}"
1212
EndProject

sample/Web/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
using Microsoft.AspNetCore.Localization;
55
using System.Globalization;
66
using FastEndpoints.ApiExplorer;
7-
using FastEndpoints.DiagnosticSources.Middleware;
7+
using FastEndpoints.OpenTelemetry;
8+
using FastEndpoints.OpenTelemetry.Extensions;
9+
using FastEndpoints.OpenTelemetry.Middleware;
810
using FastEndpoints.Swagger.Swashbuckle;
911
using Microsoft.OpenApi.Models;
1012
using OpenTelemetry.Resources;
@@ -53,14 +55,14 @@
5355
builder.Services.AddOpenTelemetryTracing(b =>
5456
{
5557
b
56-
.AddConsoleExporter()
5758
.AddSource(serviceName)
5859
.SetResourceBuilder(
5960
ResourceBuilder.CreateDefault()
6061
.AddService(serviceName: serviceName, serviceVersion: serviceVersion))
6162
.AddHttpClientInstrumentation()
6263
.AddAspNetCoreInstrumentation()
63-
.AddSource(FastEndpoints.DiagnosticSources.Trace.ActivitySourceName);
64+
.AddFastEndpointsInstrumentation()
65+
.AddConsoleExporter();
6466
});
6567

6668
var app = builder.Build();

sample/Web/Web.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="FastEndpoints" Version="5.3.1" />
13-
<PackageReference Include="FastEndpoints.Security" Version="5.3.1" />
14-
<PackageReference Include="FluentValidation" Version="11.2.2" />
12+
<PackageReference Include="FastEndpoints" Version="5.4.1" />
13+
<PackageReference Include="FastEndpoints.Security" Version="5.4.1" />
14+
<PackageReference Include="FluentValidation" Version="11.4.0" />
1515
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.10" />
1616
<PackageReference Include="OpenTelemetry" Version="1.3.1" />
1717
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.3.1" />
@@ -27,7 +27,7 @@
2727

2828
<ItemGroup>
2929
<ProjectReference Include="..\..\src\FastEndpoints.ApiExplorer\FastEndpoints.ApiExplorer.csproj" />
30-
<ProjectReference Include="..\..\src\FastEndpoints.DiagnosticSources\FastEndpoints.DiagnosticSources.csproj" />
30+
<ProjectReference Include="..\..\src\FastEndpoints.OpenTelemetry\FastEndpoints.OpenTelemetry.csproj" />
3131
<ProjectReference Include="..\..\src\FastEndpoints.Swagger.Swashbuckle\FastEndpoints.Swagger.Swashbuckle.csproj" />
3232
</ItemGroup>
3333

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ItemGroup>
2121
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
2222
<PackageReference Include="MinVer" Version="4.2.0" PrivateAssets="All"/>
23-
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" PrivateAssets="All"/>
23+
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All"/>
2424
</ItemGroup>
2525

2626
<PropertyGroup>

src/FastEndpoints.ApiExplorer/FastEndpoints.ApiExplorer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
54
<ImplicitUsings>enable</ImplicitUsings>
5+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FastEndpoints" Version="5.3.1" />
9+
<PackageReference Include="FastEndpoints" Version="5.4.1" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

src/FastEndpoints.DiagnosticSources/Endpoint/DiagnosticEndpoint.cs

Lines changed: 0 additions & 179 deletions
This file was deleted.

src/FastEndpoints.DiagnosticSources/Middleware/FastEndpointsDiagnosticsMiddleware.cs

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/FastEndpoints.DiagnosticSources/Trace.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/FastEndpoints.DiagnosticSources/Extensions/EndpointDefinitionExtensions.cs renamed to src/FastEndpoints.OpenTelemetry/Extensions/EndpointDefinitionExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
using FastEndpoints.Reflection.Extensions;
22

3-
namespace FastEndpoints.DiagnosticSources.Extensions;
3+
namespace FastEndpoints.OpenTelemetry.Extensions;
44

5-
public static class EndpointDefinitionExtensions
5+
internal static class EndpointDefinitionExtensions
66
{
7-
public static string GetActivityName(this BaseEndpoint endpoint)
7+
internal static string GetActivityName(this BaseEndpoint endpoint)
88
{
99
return $"{endpoint.GetEndpointName()}.{(endpoint.Definition.GetExecuteAsyncImplemented() ? "ExecuteAsync" : "HandleAsync")}";
1010
}
1111

12-
public static string GetActivityName(this EndpointDefinition endpointDefinition)
12+
internal static string GetActivityName(this EndpointDefinition endpointDefinition)
1313
{
1414
return $"{endpointDefinition.GetEndpointName()}.{(endpointDefinition.GetExecuteAsyncImplemented() ? "ExecuteAsync" : "HandleAsync")}";
1515
}
1616

17-
public static string GetEndpointName(this BaseEndpoint endpoint)
17+
internal static string GetEndpointName(this BaseEndpoint endpoint)
1818
{
1919
return endpoint.Definition.EndpointSummary?.Summary ?? endpoint.GetType().FullName;
2020
}
2121

22-
public static string GetEndpointName(this EndpointDefinition endpointDefinition)
22+
internal static string GetEndpointName(this EndpointDefinition endpointDefinition)
2323
{
2424
return endpointDefinition.EndpointSummary?.Summary ?? endpointDefinition.EndpointType.FullName;
2525
}

src/FastEndpoints.DiagnosticSources/FastEndpoints.DiagnosticSources.csproj renamed to src/FastEndpoints.OpenTelemetry/FastEndpoints.OpenTelemetry.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
54
<ImplicitUsings>enable</ImplicitUsings>
5+
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FastEndpoints" Version="5.3.1" />
9+
<PackageReference Include="FastEndpoints" Version="5.4.1" />
10+
<PackageReference Include="OpenTelemetry" Version="1.3.1" />
11+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.0" />
1012
</ItemGroup>
1113

1214
<ItemGroup>

0 commit comments

Comments
 (0)