From c27eb29a9d4be751c604a4c558e954fb4302ad24 Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Tue, 10 Dec 2024 16:18:31 +0000 Subject: [PATCH 1/3] Update GraphQL testing to include 8.x.x --- .../PackageVersionsGeneratorDefinitions.json | 5 +- .../build/PackageVersionsLatestMajors.g.props | 36 ++++++ .../build/PackageVersionsLatestMinors.g.props | 108 ++++++++++++++++++ .../PackageVersionsLatestSpecific.g.props | 36 ++++++ tracer/build/supported_versions.json | 2 +- .../Datadog.Dependabot.Integrations.csproj | 2 +- .../PackageVersionsLatestMajors.g.cs | 6 + .../PackageVersionsLatestMinors.g.cs | 18 +++ .../PackageVersionsLatestSpecific.g.cs | 6 + 9 files changed, 215 insertions(+), 4 deletions(-) diff --git a/tracer/build/PackageVersionsGeneratorDefinitions.json b/tracer/build/PackageVersionsGeneratorDefinitions.json index 45a8cd627820..43a66ee9469b 100644 --- a/tracer/build/PackageVersionsGeneratorDefinitions.json +++ b/tracer/build/PackageVersionsGeneratorDefinitions.json @@ -180,9 +180,10 @@ "SampleProjectName": "Samples.GraphQL7", "NugetPackageSearchName": "GraphQL", "MinVersion": "7.0.0", - "MaxVersionExclusive": "8.0.0", + "MaxVersionExclusive": "9.0.0", "SpecificVersions": [ - "7.*.*" + "7.*.*", + "8.*.*" ], "VersionConditions": [{ "MaxVersionExclusive": "8.0.0", diff --git a/tracer/build/PackageVersionsLatestMajors.g.props b/tracer/build/PackageVersionsLatestMajors.g.props index 0db53eba0cec..265853ef5a10 100644 --- a/tracer/build/PackageVersionsLatestMajors.g.props +++ b/tracer/build/PackageVersionsLatestMajors.g.props @@ -624,36 +624,72 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net5.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net6.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net7.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net8.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net9.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net9.0 + None + Samples.GraphQL7 + ApiVersion=11.3.8;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 diff --git a/tracer/build/PackageVersionsLatestMinors.g.props b/tracer/build/PackageVersionsLatestMinors.g.props index 3023c6cb986b..1de9fe5ef059 100644 --- a/tracer/build/PackageVersionsLatestMinors.g.props +++ b/tracer/build/PackageVersionsLatestMinors.g.props @@ -4776,6 +4776,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.GraphQL7 + ApiVersion=7.0.2;RestoreRecursive=false;BuildProjectReferences=false net5.0 @@ -4836,6 +4854,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.GraphQL7 + ApiVersion=7.0.2;RestoreRecursive=false;BuildProjectReferences=false net6.0 @@ -4896,6 +4932,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.GraphQL7 + ApiVersion=7.0.2;RestoreRecursive=false;BuildProjectReferences=false net7.0 @@ -4956,6 +5010,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.GraphQL7 + ApiVersion=7.0.2;RestoreRecursive=false;BuildProjectReferences=false net8.0 @@ -5016,6 +5088,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.GraphQL7 + ApiVersion=7.0.2;RestoreRecursive=false;BuildProjectReferences=false net9.0 @@ -5076,6 +5166,24 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.0.2;RestoreRecursive=false;BuildProjectReferences=false + net9.0 + None + Samples.GraphQL7 + + + ApiVersion=8.1.0;RestoreRecursive=false;BuildProjectReferences=false + net9.0 + None + Samples.GraphQL7 + + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net9.0 + None + Samples.GraphQL7 + ApiVersion=11.0.9;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 diff --git a/tracer/build/PackageVersionsLatestSpecific.g.props b/tracer/build/PackageVersionsLatestSpecific.g.props index cffde0432c10..d032cad081e8 100644 --- a/tracer/build/PackageVersionsLatestSpecific.g.props +++ b/tracer/build/PackageVersionsLatestSpecific.g.props @@ -1428,36 +1428,72 @@ NOTE: This code was generated by the GeneratePackageVersions tool. To safely None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + netcoreapp3.1 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net5.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net5.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net6.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net6.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net7.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net7.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net8.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net8.0 + None + Samples.GraphQL7 + ApiVersion=7.9.0;RestoreRecursive=false;BuildProjectReferences=false net9.0 None Samples.GraphQL7 + + ApiVersion=8.2.1;RestoreRecursive=false;BuildProjectReferences=false + net9.0 + None + Samples.GraphQL7 + ApiVersion=11.3.8;RestoreRecursive=false;BuildProjectReferences=false netcoreapp3.1 diff --git a/tracer/build/supported_versions.json b/tracer/build/supported_versions.json index 5aaea0b3fdca..6d5b8c1be123 100644 --- a/tracer/build/supported_versions.json +++ b/tracer/build/supported_versions.json @@ -518,7 +518,7 @@ "minVersionTestedInclusive": "4.1.0", "maxVersionSupportedInclusive": "7.9.0", "maxVersionAvailableInclusive": "8.2.1", - "maxVersionTestedInclusive": "7.9.0" + "maxVersionTestedInclusive": "8.2.1" } ] }, diff --git a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj index 1ffce1c90c02..ad1b3ed3ba64 100644 --- a/tracer/dependabot/Datadog.Dependabot.Integrations.csproj +++ b/tracer/dependabot/Datadog.Dependabot.Integrations.csproj @@ -74,7 +74,7 @@ - + diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs index fe09f2decfe4..2d50b0b3d419 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMajors.g.cs @@ -419,21 +419,27 @@ public class PackageVersionsLatestMajors #else #if NETCOREAPP3_1 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET5_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET6_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET7_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET8_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET9_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs index 7d8c81278259..1a72c7775cd3 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestMinors.g.cs @@ -1111,6 +1111,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #if NET5_0 new object[] { "7.0.2" }, @@ -1123,6 +1126,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #if NET6_0 new object[] { "7.0.2" }, @@ -1135,6 +1141,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #if NET7_0 new object[] { "7.0.2" }, @@ -1147,6 +1156,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #if NET8_0 new object[] { "7.0.2" }, @@ -1159,6 +1171,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #if NET9_0 new object[] { "7.0.2" }, @@ -1171,6 +1186,9 @@ public class PackageVersionsLatestMinors new object[] { "7.7.2" }, new object[] { "7.8.0" }, new object[] { "7.9.0" }, + new object[] { "8.0.2" }, + new object[] { "8.1.0" }, + new object[] { "8.2.1" }, #endif #endif }; diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs index ae727b9c7142..e7d4f6955c3f 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/PackageVersionsLatestSpecific.g.cs @@ -553,21 +553,27 @@ public class PackageVersionsLatestSpecific #else #if NETCOREAPP3_1 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET5_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET6_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET7_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET8_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #if NET9_0 new object[] { "7.9.0" }, + new object[] { "8.2.1" }, #endif #endif }; From 62ba562493f7e1a0474166990d0506668e138ccb Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Tue, 10 Dec 2024 16:37:38 +0000 Subject: [PATCH 2/3] Try adding support for Graphql 8.x.x --- tracer/build/supported_calltargets.g.json | 29 ++++++++- tracer/missing-nullability-files.csv | 1 - .../GraphQL/Net/DocumentV5Struct.cs | 4 +- .../Net/ExecuteAsyncIntegrationV5AndV7.cs | 4 +- .../GraphQL/Net/GraphQLCommon.cs | 1 + .../GraphQL/Net/ValidateAsyncIntegrationV8.cs | 62 +++++++++++++++++++ .../InstrumentationDefinitions.g.cs | 1 + .../InstrumentationDefinitions.g.cs | 1 + .../InstrumentationDefinitions.g.cs | 1 + .../InstrumentationDefinitions.g.cs | 1 + .../Generated/generated_calltargets.g.h | 5 +- 11 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ValidateAsyncIntegrationV8.cs diff --git a/tracer/build/supported_calltargets.g.json b/tracer/build/supported_calltargets.g.json index 04115fed3852..8eb0bd42ea5c 100644 --- a/tracer/build/supported_calltargets.g.json +++ b/tracer/build/supported_calltargets.g.json @@ -6264,7 +6264,7 @@ "Item3": 0 }, "MaximumVersion": { - "Item1": 7, + "Item1": 8, "Item2": 65535, "Item3": 65535 }, @@ -6312,7 +6312,7 @@ "Item3": 0 }, "MaximumVersion": { - "Item1": 7, + "Item1": 8, "Item2": 65535, "Item3": 65535 }, @@ -6433,6 +6433,31 @@ "IsAdoNetIntegration": false, "InstrumentationCategory": 1 }, + { + "IntegrationName": "GraphQL", + "AssemblyName": "GraphQL", + "TargetTypeName": "GraphQL.Validation.DocumentValidator", + "TargetMethodName": "ValidateAsyncCoreAsync", + "TargetReturnType": "System.Threading.Tasks.Task`1[!0]", + "TargetParameterTypes": [ + "GraphQL.Validation.ValidationContext", + "System.Collections.Generic.IEnumerable`1[GraphQL.Validation.IValidationRule]" + ], + "MinimumVersion": { + "Item1": 7, + "Item2": 0, + "Item3": 0 + }, + "MaximumVersion": { + "Item1": 8, + "Item2": 65535, + "Item3": 65535 + }, + "InstrumentationTypeName": "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8", + "IntegrationKind": 0, + "IsAdoNetIntegration": false, + "InstrumentationCategory": 1 + }, { "IntegrationName": "GraphQL", "AssemblyName": "GraphQL.SystemReactive", diff --git a/tracer/missing-nullability-files.csv b/tracer/missing-nullability-files.csv index 2a8138b40100..8b50ad309f5c 100644 --- a/tracer/missing-nullability-files.csv +++ b/tracer/missing-nullability-files.csv @@ -609,7 +609,6 @@ src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/HotChocolate/IQueryRes src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/HotChocolate/NameStringProxy.cs src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/HotChocolate/OperationTypeProxy.cs src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/HotChocolate/PreparedOperationStruct.cs -src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/DocumentV5Struct.cs src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegration.cs src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegrationV5AndV7.cs src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/GraphQLCommon.cs diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/DocumentV5Struct.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/DocumentV5Struct.cs index 8cde01d9c069..0a419be92340 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/DocumentV5Struct.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/DocumentV5Struct.cs @@ -3,6 +3,8 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // +#nullable enable + using Datadog.Trace.DuckTyping; namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net @@ -14,6 +16,6 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net [DuckCopy] internal struct DocumentV5Struct { - public object Source; + public object? Source; } } diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegrationV5AndV7.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegrationV5AndV7.cs index 368dbeae469e..6323ebd8026f 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegrationV5AndV7.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ExecuteAsyncIntegrationV5AndV7.cs @@ -20,7 +20,7 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net AssemblyName = GraphQLCommon.GraphQLAssembly, TypeName = "GraphQL.Execution.ExecutionStrategy", MinimumVersion = GraphQLCommon.Major5, - MaximumVersion = GraphQLCommon.Major7)] + MaximumVersion = GraphQLCommon.Major8)] [InstrumentMethod( IntegrationName = GraphQLCommon.IntegrationName, MethodName = GraphQLCommon.ExecuteAsyncMethodName, @@ -29,7 +29,7 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net AssemblyName = GraphQLCommon.GraphQLAssembly, TypeName = "GraphQL.Execution.SubscriptionExecutionStrategy", MinimumVersion = GraphQLCommon.Major5, - MaximumVersion = GraphQLCommon.Major7)] + MaximumVersion = GraphQLCommon.Major8)] [Browsable(false)] [EditorBrowsable(EditorBrowsableState.Never)] public class ExecuteAsyncIntegrationV5AndV7 diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/GraphQLCommon.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/GraphQLCommon.cs index d79fbe3611d6..e190ab6682a2 100644 --- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/GraphQLCommon.cs +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/GraphQLCommon.cs @@ -24,6 +24,7 @@ internal class GraphQLCommon : GraphQLCommonBase internal const string Major4 = "4"; internal const string Major5 = "5"; internal const string Major7 = "7"; + internal const string Major8 = "8"; internal const string IntegrationName = nameof(Configuration.IntegrationId.GraphQL); internal const IntegrationId IntegrationId = Configuration.IntegrationId.GraphQL; diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ValidateAsyncIntegrationV8.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ValidateAsyncIntegrationV8.cs new file mode 100644 index 000000000000..f69869992ec9 --- /dev/null +++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/GraphQL/Net/ValidateAsyncIntegrationV8.cs @@ -0,0 +1,62 @@ +// +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. +// + +#nullable enable + +using System; +using System.ComponentModel; +using Datadog.Trace.ClrProfiler.CallTarget; + +namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net; + +/// +/// GraphQL.Validation.DocumentValidator calltarget instrumentation for GraphQL 8 +/// +[InstrumentMethod( + AssemblyName = GraphQLCommon.GraphQLAssembly, + TypeName = "GraphQL.Validation.DocumentValidator", + MethodName = "ValidateAsyncCoreAsync", + ReturnTypeName = ClrNames.GenericTaskWithGenericClassParameter, + ParameterTypeNames = new[] { "GraphQL.Validation.ValidationContext", "System.Collections.Generic.IEnumerable`1[GraphQL.Validation.IValidationRule]" }, + MinimumVersion = GraphQLCommon.Major7, + MaximumVersion = GraphQLCommon.Major8, + IntegrationName = GraphQLCommon.IntegrationName)] +[Browsable(false)] +[EditorBrowsable(EditorBrowsableState.Never)] +public class ValidateAsyncIntegrationV8 +{ + internal static CallTargetState OnMethodBegin(TTarget instance, TValidationContext validationContext, TRules rules) + where TValidationContext : IValidationContext + { + return new CallTargetState(GraphQLCommon.CreateScopeFromValidate(Tracer.Instance, validationContext.Document.Source?.ToString())); + } + + internal static TValidationResult OnAsyncMethodEnd(TTarget instance, TValidationResult validationResult, Exception? exception, in CallTargetState state) + where TValidationResult : IValidationResult // The constraint type differs + { + if (state.Scope is not { } scope) + { + return validationResult; + } + + try + { + if (exception != null) + { + scope.Span?.SetException(exception); + } + else + { + GraphQLCommon.RecordExecutionErrorsIfPresent(scope.Span, GraphQLCommon.ValidationErrorType, validationResult.Errors); + } + } + finally + { + scope.Dispose(); + } + + return validationResult; + } +} diff --git a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index c70c7865384b..4f783bbeed07 100644 --- a/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net461/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -298,6 +298,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV4" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV5AndV7" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.GraphQL, "Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.IAST.ParsingPrimitivesReadRawStringIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 82175e5199f1..c664dc59cd0f 100644 --- a/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/net6.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -311,6 +311,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV4" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV5AndV7" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.GraphQL, "Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.IAST.ParsingPrimitivesReadRawStringIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 10c194a817bb..ec5d56a0e69f 100644 --- a/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netcoreapp3.1/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -307,6 +307,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV4" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV5AndV7" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.GraphQL, "Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.IAST.ParsingPrimitivesReadRawStringIntegration" diff --git a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs index 10c194a817bb..ec5d56a0e69f 100644 --- a/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs +++ b/tracer/src/Datadog.Trace/Generated/netstandard2.0/Datadog.Trace.SourceGenerators/InstrumentationDefinitionsGenerator/InstrumentationDefinitions.g.cs @@ -307,6 +307,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName) or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegration" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV4" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV5AndV7" + or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8" or "Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration" => Datadog.Trace.Configuration.IntegrationId.GraphQL, "Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.IAST.ParsingPrimitivesReadRawStringIntegration" diff --git a/tracer/src/Datadog.Tracer.Native/Generated/generated_calltargets.g.h b/tracer/src/Datadog.Tracer.Native/Generated/generated_calltargets.g.h index 90ac9ebef707..b7420f0fdf87 100644 --- a/tracer/src/Datadog.Tracer.Native/Generated/generated_calltargets.g.h +++ b/tracer/src/Datadog.Tracer.Native/Generated/generated_calltargets.g.h @@ -577,13 +577,14 @@ std::vector g_callTargets= {(WCHAR*)WStr("Elasticsearch.Net"),(WCHAR*)WStr("Elasticsearch.Net.Transport`1"),(WCHAR*)WStr("Request"),g_callTargets_Sig_004,5,7,0,0,7,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.Elasticsearch.V7.Transport_Request_Integration"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("Elasticsearch.Net"),(WCHAR*)WStr("Elasticsearch.Net.Transport`1"),(WCHAR*)WStr("RequestAsync"),g_callTargets_Sig_174,6,7,0,0,7,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.Elasticsearch.V7.Transport_RequestAsync_Integration"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.ExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,2,3,0,4,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration"),CallTargetKind::Default,1,15}, -{(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.ExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,5,0,0,7,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegrationV5AndV7"),CallTargetKind::Default,1,15}, +{(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.ExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,5,0,0,8,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegrationV5AndV7"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.SubscriptionExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,2,3,0,3,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration"),CallTargetKind::Default,1,15}, -{(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.SubscriptionExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,5,0,0,7,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegrationV5AndV7"),CallTargetKind::Default,1,15}, +{(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Execution.SubscriptionExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,5,0,0,8,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegrationV5AndV7"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Validation.DocumentValidator"),(WCHAR*)WStr("Validate"),g_callTargets_Sig_051,7,2,3,0,2,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateIntegration"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Validation.DocumentValidator"),(WCHAR*)WStr("ValidateAsync"),g_callTargets_Sig_179,7,3,0,0,3,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegration"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Validation.DocumentValidator"),(WCHAR*)WStr("ValidateAsync"),g_callTargets_Sig_176,7,4,0,0,4,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV4"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Validation.DocumentValidator"),(WCHAR*)WStr("ValidateAsyncCoreAsync"),g_callTargets_Sig_177,3,5,0,0,7,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV5AndV7"),CallTargetKind::Default,1,15}, +{(WCHAR*)WStr("GraphQL"),(WCHAR*)WStr("GraphQL.Validation.DocumentValidator"),(WCHAR*)WStr("ValidateAsyncCoreAsync"),g_callTargets_Sig_177,3,7,0,0,8,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ValidateAsyncIntegrationV8"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("GraphQL.SystemReactive"),(WCHAR*)WStr("GraphQL.Execution.SubscriptionExecutionStrategy"),(WCHAR*)WStr("ExecuteAsync"),g_callTargets_Sig_169,2,4,0,0,4,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.GraphQL.Net.ExecuteAsyncIntegration"),CallTargetKind::Default,1,15}, {(WCHAR*)WStr("Google.Protobuf"),(WCHAR*)WStr("Google.Protobuf.ParsingPrimitives"),(WCHAR*)WStr("ReadRawString"),g_callTargets_Sig_140,4,3,0,0,3,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.IAST.ParsingPrimitivesReadRawStringIntegration"),CallTargetKind::Default,4,15}, {(WCHAR*)WStr("Grpc.AspNetCore.Server"),(WCHAR*)WStr("Grpc.AspNetCore.Server.Internal.CallHandlers.ServerCallHandlerBase`3"),(WCHAR*)WStr("HandleCallAsync"),g_callTargets_Sig_159,2,2,0,0,2,65535,65535,assemblyName,(WCHAR*)WStr("Datadog.Trace.ClrProfiler.AutoInstrumentation.Grpc.GrpcDotNet.GrpcAspNetCoreServer.ServerCallHandlerBaseHandleCallAsyncIntegration"),CallTargetKind::Default,1,14}, From 8ba97ea0bf64db14fac1b1b951b9af3df4758b3c Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Wed, 11 Dec 2024 10:09:45 +0000 Subject: [PATCH 3/3] Update sample app to support GraphQL 8 --- .../GraphQLCommon.cs | 7 +++++-- .../Samples.GraphQL7/Samples.GraphQL7.csproj | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLCommon.cs b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLCommon.cs index 3232c5b4ac6b..f00e5c9f9fa2 100644 --- a/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLCommon.cs +++ b/tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLCommon.cs @@ -4,6 +4,7 @@ // using System; +using System.Collections.Specialized; using System.IO; using System.Net; using System.Net.WebSockets; @@ -21,9 +22,11 @@ public static void SubmitRequest(ITestOutputHelper output, int aspNetCorePort, R { try { - var request = WebRequest.Create($"http://localhost:{aspNetCorePort}{requestInfo.Url}"); + var request = (HttpWebRequest)WebRequest.Create($"http://localhost:{aspNetCorePort}{requestInfo.Url}"); request.Method = requestInfo.HttpMethod; - ((HttpWebRequest)request).UserAgent = "testhelper"; + request.UserAgent = "testhelper"; + // Added to avoid CSRF values (required in graphl.NET v8+ + request.Headers["GraphQL-Require-Preflight"] = "1"; if (requestInfo.RequestBody != null) { diff --git a/tracer/test/test-applications/integrations/Samples.GraphQL7/Samples.GraphQL7.csproj b/tracer/test/test-applications/integrations/Samples.GraphQL7/Samples.GraphQL7.csproj index 9671a7097e1f..955791725349 100644 --- a/tracer/test/test-applications/integrations/Samples.GraphQL7/Samples.GraphQL7.csproj +++ b/tracer/test/test-applications/integrations/Samples.GraphQL7/Samples.GraphQL7.csproj @@ -2,8 +2,9 @@ netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0 - 7.3.1 + 8.2.1 $(DefineConstants);GRAPHQL_7_0 + $(DefineConstants);GRAPHQL_8_0 false @@ -18,11 +19,16 @@ - + + + + + +