Skip to content

Commit c5861cc

Browse files
committed
Fix for net2.2 > net3.1
1 parent 3f3c574 commit c5861cc

File tree

8 files changed

+989
-900
lines changed

8 files changed

+989
-900
lines changed

tracer/build/supported_calltargets.g.json

+56-5
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@
10361036
"System.Action`1[Microsoft.AspNetCore.Builder.IApplicationBuilder]"
10371037
],
10381038
"MinimumVersion": {
1039-
"Item1": 2,
1039+
"Item1": 5,
10401040
"Item2": 0,
10411041
"Item3": 0
10421042
},
@@ -1048,7 +1048,33 @@
10481048
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration",
10491049
"IntegrationKind": 0,
10501050
"IsAdoNetIntegration": false,
1051-
"InstrumentationCategory": 1
1051+
"InstrumentationCategory": 2
1052+
},
1053+
{
1054+
"IntegrationName": "AspNetCore",
1055+
"AssemblyName": "Microsoft.AspNetCore.Http.Abstractions",
1056+
"TargetTypeName": "Microsoft.AspNetCore.Builder.MapExtensions",
1057+
"TargetMethodName": "Map",
1058+
"TargetReturnType": "Microsoft.AspNetCore.Builder.IApplicationBuilder",
1059+
"TargetParameterTypes": [
1060+
"Microsoft.AspNetCore.Builder.IApplicationBuilder",
1061+
"Microsoft.AspNetCore.Http.PathString",
1062+
"System.Action`1[Microsoft.AspNetCore.Builder.IApplicationBuilder]"
1063+
],
1064+
"MinimumVersion": {
1065+
"Item1": 2,
1066+
"Item2": 2,
1067+
"Item3": 0
1068+
},
1069+
"MaximumVersion": {
1070+
"Item1": 3,
1071+
"Item2": 65535,
1072+
"Item3": 65535
1073+
},
1074+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration",
1075+
"IntegrationKind": 0,
1076+
"IsAdoNetIntegration": false,
1077+
"InstrumentationCategory": 2
10521078
},
10531079
{
10541080
"IntegrationName": "AspNetCore",
@@ -1062,7 +1088,7 @@
10621088
],
10631089
"MinimumVersion": {
10641090
"Item1": 2,
1065-
"Item2": 0,
1091+
"Item2": 2,
10661092
"Item3": 0
10671093
},
10681094
"MaximumVersion": {
@@ -1073,7 +1099,7 @@
10731099
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.RunExtensionsRunIntegration",
10741100
"IntegrationKind": 0,
10751101
"IsAdoNetIntegration": false,
1076-
"InstrumentationCategory": 1
1102+
"InstrumentationCategory": 2
10771103
},
10781104
{
10791105
"IntegrationName": "AspNetCore",
@@ -1297,6 +1323,31 @@
12971323
"IsAdoNetIntegration": false,
12981324
"InstrumentationCategory": 6
12991325
},
1326+
{
1327+
"IntegrationName": "AspNetCore",
1328+
"AssemblyName": "Microsoft.AspNetCore.Server.Kestrel.Core",
1329+
"TargetTypeName": "Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer",
1330+
"TargetMethodName": "StartAsync",
1331+
"TargetReturnType": "System.Threading.Tasks.Task",
1332+
"TargetParameterTypes": [
1333+
"Microsoft.AspNetCore.Hosting.Server.IHttpApplication`1[!!0]",
1334+
"System.Threading.CancellationToken"
1335+
],
1336+
"MinimumVersion": {
1337+
"Item1": 2,
1338+
"Item2": 2,
1339+
"Item3": 0
1340+
},
1341+
"MaximumVersion": {
1342+
"Item1": 3,
1343+
"Item2": 65535,
1344+
"Item3": 65535
1345+
},
1346+
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration",
1347+
"IntegrationKind": 0,
1348+
"IsAdoNetIntegration": false,
1349+
"InstrumentationCategory": 2
1350+
},
13001351
{
13011352
"IntegrationName": "AspNetCore",
13021353
"AssemblyName": "Microsoft.AspNetCore.Server.Kestrel.Core",
@@ -1320,7 +1371,7 @@
13201371
"InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration",
13211372
"IntegrationKind": 0,
13221373
"IsAdoNetIntegration": false,
1323-
"InstrumentationCategory": 1
1374+
"InstrumentationCategory": 2
13241375
},
13251376
{
13261377
"IntegrationName": "AspNetCore",

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AspNetCore/EndpointsCollection/KestrelServerImplStartAsyncIntegration.cs

+11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsColl
2929
ParameterTypeNames = ["Microsoft.AspNetCore.Hosting.Server.IHttpApplication`1[!!0]", ClrNames.CancellationToken],
3030
MinimumVersion = "2.2.0",
3131
MaximumVersion = SupportedVersions.LatestDotNet,
32+
InstrumentationCategory = InstrumentationCategory.AppSec,
33+
IntegrationName = nameof(IntegrationId.AspNetCore))]
34+
[InstrumentMethod(
35+
AssemblyName = "Microsoft.AspNetCore.Server.Kestrel.Core",
36+
TypeName = "Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer",
37+
MethodName = "StartAsync",
38+
ReturnTypeName = ClrNames.Task,
39+
ParameterTypeNames = ["Microsoft.AspNetCore.Hosting.Server.IHttpApplication`1[!!0]", ClrNames.CancellationToken],
40+
MinimumVersion = "2.2.0",
41+
MaximumVersion = "3.*.*",
42+
InstrumentationCategory = InstrumentationCategory.AppSec,
3243
IntegrationName = nameof(IntegrationId.AspNetCore))]
3344
[Browsable(false)]
3445
[EditorBrowsable(EditorBrowsableState.Never)]

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AspNetCore/EndpointsCollection/MapExtensionsMapIntegration.cs

+24-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// </copyright>
55
#nullable enable
66

7-
#if !NETFRAMEWORK
7+
#if NETCOREAPP2_2_OR_GREATER
88

99
using System;
1010
using System.ComponentModel;
@@ -23,8 +23,19 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsColl
2323
MethodName = "Map",
2424
ReturnTypeName = "Microsoft.AspNetCore.Builder.IApplicationBuilder",
2525
ParameterTypeNames = ["Microsoft.AspNetCore.Builder.IApplicationBuilder", "Microsoft.AspNetCore.Http.PathString", ClrNames.Bool, "System.Action`1[Microsoft.AspNetCore.Builder.IApplicationBuilder]"],
26-
MinimumVersion = "2.0.0",
27-
MaximumVersion = "9.*.*",
26+
MinimumVersion = "5.0.0",
27+
MaximumVersion = SupportedVersions.LatestDotNet,
28+
InstrumentationCategory = InstrumentationCategory.AppSec,
29+
IntegrationName = nameof(IntegrationId.AspNetCore))]
30+
[InstrumentMethod(
31+
AssemblyName = "Microsoft.AspNetCore.Http.Abstractions",
32+
TypeName = "Microsoft.AspNetCore.Builder.MapExtensions",
33+
MethodName = "Map",
34+
ReturnTypeName = "Microsoft.AspNetCore.Builder.IApplicationBuilder",
35+
ParameterTypeNames = ["Microsoft.AspNetCore.Builder.IApplicationBuilder", "Microsoft.AspNetCore.Http.PathString", "System.Action`1[Microsoft.AspNetCore.Builder.IApplicationBuilder]"],
36+
MinimumVersion = "2.2.0",
37+
MaximumVersion = "3.*.*",
38+
InstrumentationCategory = InstrumentationCategory.AppSec,
2839
IntegrationName = nameof(IntegrationId.AspNetCore))]
2940
[Browsable(false)]
3041
[EditorBrowsable(EditorBrowsableState.Never)]
@@ -40,6 +51,16 @@ internal static CallTargetState OnMethodBegin<TTarget, TApp, TPathMatch, TConfig
4051
return CallTargetState.GetDefault();
4152
}
4253

54+
internal static CallTargetState OnMethodBegin<TTarget, TApp, TPathMatch, TConfiguration>(ref TApp? app, ref TPathMatch pathMatch, ref TConfiguration? configuration)
55+
{
56+
if (Security.Instance.ApiSecurity.CanCollectEndpoints())
57+
{
58+
MapEndpointsCollection.BeggingMapEndpoint(pathMatch!.ToString()!);
59+
}
60+
61+
return CallTargetState.GetDefault();
62+
}
63+
4364
internal static CallTargetReturn<TReturn?> OnMethodEnd<TTarget, TReturn>(TReturn? returnValue, Exception? exception, in CallTargetState state)
4465
{
4566
if (Security.Instance.ApiSecurity.CanCollectEndpoints())

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/AspNetCore/EndpointsCollection/RunExtensionsRunIntegration.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// </copyright>
55
#nullable enable
66

7-
#if !NETFRAMEWORK
7+
#if NETCOREAPP2_2_OR_GREATER
88

99
using System.ComponentModel;
1010
using Datadog.Trace.AppSec;
@@ -22,8 +22,9 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsColl
2222
MethodName = "Run",
2323
ReturnTypeName = ClrNames.Void,
2424
ParameterTypeNames = ["Microsoft.AspNetCore.Builder.IApplicationBuilder", "Microsoft.AspNetCore.Http.RequestDelegate"],
25-
MinimumVersion = "2.0.0",
26-
MaximumVersion = "9.*.*",
25+
MinimumVersion = "2.2.0",
26+
MaximumVersion = SupportedVersions.LatestDotNet,
27+
InstrumentationCategory = InstrumentationCategory.AppSec,
2728
IntegrationName = nameof(IntegrationId.AspNetCore))]
2829
[Browsable(false)]
2930
[EditorBrowsable(EditorBrowsableState.Never)]

tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
8181
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.AspNetCoreBlockMiddlewareIntegrationEnd"
8282
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.HttpContextSetUser"
8383
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration"
84+
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration"
8485
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.RunExtensionsRunIntegration"
8586
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
8687
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
@@ -92,6 +93,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
9293
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.FireOnStartCommon"
9394
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.FireOnStartCommon"
9495
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration"
96+
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration"
9597
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.Session.SessionOptionsIdleTimeoutIntegration"
9698
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.StaticFiles.DirectoryBrowserExtensionsUseDirectoryBrowserIntegration"
9799
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.StaticFiles.DirectoryBrowserExtensionsUseDirectoryBrowserIntegration"

tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
7979
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.AspNetCoreBlockMiddlewareIntegrationEnd"
8080
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.HttpContextSetUser"
8181
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration"
82+
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration"
8283
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.RunExtensionsRunIntegration"
8384
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
8485
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
@@ -90,6 +91,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
9091
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.FireOnStartCommon"
9192
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.FireOnStartCommon"
9293
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration"
94+
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.KestrelServerImplStartAsyncIntegration"
9395
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.Session.SessionOptionsIdleTimeoutIntegration"
9496
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.StaticFiles.DirectoryBrowserExtensionsUseDirectoryBrowserIntegration"
9597
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.StaticFiles.DirectoryBrowserExtensionsUseDirectoryBrowserIntegration"

tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs

-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
7878
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.AspNetCoreBlockMiddlewareIntegrationEnd"
7979
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.AspNetCoreBlockMiddlewareIntegrationEnd"
8080
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.HttpContextSetUser"
81-
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.MapExtensionsMapIntegration"
82-
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.EndpointsCollection.RunExtensionsRunIntegration"
8381
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
8482
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInIntegration"
8583
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.AspNetCore.UserEvents.SignInManagerPasswordSignInUserIntegration"

0 commit comments

Comments
 (0)