diff --git a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkDiscreteStats.cs b/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkDiscreteStats.cs
deleted file mode 100644
index b40483c22477..000000000000
--- a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkDiscreteStats.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// 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
-
-namespace Datadog.Trace.Ci;
-
-// NOTE: This is a direct copy of BenchmarkDiscreteStats in Datadog.Trace
-// but as a class instead of a struct to allow reverse duck-typing
-
-///
-/// Benchmark measurement discrete stats
-///
-public class BenchmarkDiscreteStats
-{
- private static readonly BenchmarkDiscreteStats Empty = new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Number of samples
- /// Max value
- /// Min value
- /// Mean value
- /// Median value
- /// Standard deviation value
- /// Standard error value
- /// Kurtosis value
- /// Skewness value
- /// 99 percentile value
- /// 95 percentile value
- /// 90 percentile value
- public BenchmarkDiscreteStats(int n, double max, double min, double mean, double median, double standardDeviation, double standardError, double kurtosis, double skewness, double p99, double p95, double p90)
- {
- N = n;
- Max = max;
- Min = min;
- Mean = mean;
- Median = median;
- StandardDeviation = standardDeviation;
- StandardError = standardError;
- Kurtosis = kurtosis;
- Skewness = skewness;
- P99 = p99;
- P95 = p95;
- P90 = p90;
- }
-
- ///
- /// Gets number of samples
- ///
- public int N { get; }
-
- ///
- /// Gets max value
- ///
- public double Max { get; }
-
- ///
- /// Gets min value
- ///
- public double Min { get; }
-
- ///
- /// Gets mean value
- ///
- public double Mean { get; }
-
- ///
- /// Gets median value
- ///
- public double Median { get; }
-
- ///
- /// Gets standard deviation value
- ///
- public double StandardDeviation { get; }
-
- ///
- /// Gets standard error value
- ///
- public double StandardError { get; }
-
- ///
- /// Gets kurtosis value
- ///
- public double Kurtosis { get; }
-
- ///
- /// Gets skewness value
- ///
- public double Skewness { get; }
-
- ///
- /// Gets 99 percentile value
- ///
- public double P99 { get; }
-
- ///
- /// Gets 95 percentile value
- ///
- public double P95 { get; }
-
- ///
- /// Gets 90 percentile value
- ///
- public double P90 { get; }
-
- ///
- /// Get benchmark discrete stats from an array of doubles
- ///
- /// Array of doubles
- /// Benchmark discrete stats instance
- public static BenchmarkDiscreteStats GetFrom(double[] values)
- {
- if (values is null || values.Length == 0)
- {
- return Empty;
- }
-
- values = values.ToArray();
- Array.Sort(values);
- var count = values.Length;
- var halfIndex = count / 2;
-
- var max = values[count - 1];
- var min = values[0];
- var mean = values.Average();
- var median = count % 2 == 0 ? (values[halfIndex - 1] + values[halfIndex]) / 2d : values[halfIndex];
-
- double sumOfSquaredDifferences = 0;
- double sumOfCubedDifferences = 0;
- double sumOfFourthPowerDifferences = 0;
- foreach (var number in values)
- {
- sumOfSquaredDifferences += Math.Pow(number - mean, 2);
- sumOfCubedDifferences += Math.Pow(number - mean, 3);
- sumOfFourthPowerDifferences += Math.Pow(number - mean, 4);
- }
-
- var variance = sumOfSquaredDifferences / count;
- var standardDeviation = Math.Sqrt(variance);
- var standardError = standardDeviation / Math.Sqrt(count);
- var kurtosis = ((sumOfFourthPowerDifferences / count) / Math.Pow(variance, 2)) - 3;
- var skewness = (sumOfCubedDifferences / count) / Math.Pow(standardDeviation, 3);
- var p90 = GetPercentile(90);
- var p95 = GetPercentile(95);
- var p99 = GetPercentile(99);
-
- return new BenchmarkDiscreteStats(count, max, min, mean, median, standardDeviation, standardError, kurtosis, skewness, p99, p95, p90);
-
- double GetPercentile(double percentile)
- {
- var index = (int)Math.Round((percentile / 100.0) * (values.Length - 1), 0);
- return values[index];
- }
- }
-}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkHostInfo.cs b/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkHostInfo.cs
deleted file mode 100644
index a1005f2965bd..000000000000
--- a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkHostInfo.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// 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
-
-namespace Datadog.Trace.Ci;
-
-// NOTE: This is a direct copy of BenchmarkHostInfo in Datadog.Trace
-// but as a class instead of a struct to allow reverse duck-typing
-
-///
-/// Benchmark host info
-///
-public class BenchmarkHostInfo
-{
- ///
- /// Gets or sets processor Name
- ///
- public string? ProcessorName { get; set; }
-
- ///
- /// Gets or sets physical processor count
- ///
- public int? ProcessorCount { get; set; }
-
- ///
- /// Gets or sets physical core count
- ///
- public int? PhysicalCoreCount { get; set; }
-
- ///
- /// Gets or sets logical core count
- ///
- public int? LogicalCoreCount { get; set; }
-
- ///
- /// Gets or sets processor max frequency hertz
- ///
- public double? ProcessorMaxFrequencyHertz { get; set; }
-
- ///
- /// Gets or sets oS Version
- ///
- public string? OsVersion { get; set; }
-
- ///
- /// Gets or sets runtime version
- ///
- public string? RuntimeVersion { get; set; }
-
- ///
- /// Gets or sets chronometer Frequency
- ///
- public double? ChronometerFrequencyHertz { get; set; }
-
- ///
- /// Gets or sets chronometer resolution
- ///
- public double? ChronometerResolution { get; set; }
-}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkJobInfo.cs b/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkJobInfo.cs
deleted file mode 100644
index affbecb03eb7..000000000000
--- a/tracer/src/Datadog.Trace.Manual/Ci/BenchmarkJobInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// 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
-
-namespace Datadog.Trace.Ci;
-
-// NOTE: This is a direct copy of BenchmarkDiscreteStats in Datadog.Trace
-// but as a class instead of a struct to allow reverse duck-typing
-
-///
-/// Benchmark job info
-///
-public class BenchmarkJobInfo
-{
- ///
- /// Gets or sets job description
- ///
- public string? Description { get; set; }
-
- ///
- /// Gets or sets job platform
- ///
- public string? Platform { get; set; }
-
- ///
- /// Gets or sets job runtime name
- ///
- public string? RuntimeName { get; set; }
-
- ///
- /// Gets or sets job runtime moniker
- ///
- public string? RuntimeMoniker { get; set; }
-}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/ITest.cs b/tracer/src/Datadog.Trace.Manual/Ci/ITest.cs
index eb35ac5af3dd..a20be4006d96 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/ITest.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/ITest.cs
@@ -69,27 +69,6 @@ public interface ITest
/// Traits dictionary
void SetTraits(Dictionary> traits);
- ///
- /// Set Test parameters
- ///
- /// TestParameters instance
- void SetParameters(TestParameters parameters);
-
- ///
- /// Set benchmark metadata
- ///
- /// Host info
- /// Job info
- void SetBenchmarkMetadata(BenchmarkHostInfo hostInfo, BenchmarkJobInfo jobInfo);
-
- ///
- /// Add benchmark data
- ///
- /// Measure type
- /// Measure info
- /// Statistics values
- void AddBenchmarkData(BenchmarkMeasureType measureType, string info, BenchmarkDiscreteStats statistics);
-
///
/// Close test
///
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTest.cs b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTest.cs
index fe098d5b416f..c6b10f3937c5 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTest.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTest.cs
@@ -9,13 +9,19 @@
namespace Datadog.Trace.Ci.Stubs;
-internal class NullTest(ITestSuite testSuite, string name, DateTimeOffset? startDate) : ITest
+internal class NullTest : ITest
{
- public string? Name { get; } = name;
+ public static readonly NullTest Instance = new();
- public DateTimeOffset StartTime { get; } = startDate ?? DateTimeOffset.UtcNow;
+ private NullTest()
+ {
+ }
+
+ public string? Name => "Undefined";
+
+ public DateTimeOffset StartTime => default;
- public ITestSuite Suite { get; } = testSuite;
+ public ITestSuite Suite => NullTestSuite.Instance;
public void SetTag(string key, string? value)
{
@@ -41,18 +47,6 @@ public void SetTraits(Dictionary> traits)
{
}
- public void SetParameters(TestParameters parameters)
- {
- }
-
- public void SetBenchmarkMetadata(BenchmarkHostInfo hostInfo, BenchmarkJobInfo jobInfo)
- {
- }
-
- public void AddBenchmarkData(BenchmarkMeasureType measureType, string info, BenchmarkDiscreteStats statistics)
- {
- }
-
public void Close(TestStatus status)
{
}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestModule.cs b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestModule.cs
index be63df2453fc..7ae1a059eead 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestModule.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestModule.cs
@@ -5,13 +5,19 @@
namespace Datadog.Trace.Ci.Stubs;
-internal class NullTestModule(string name, string? framework, DateTimeOffset? startDate) : ITestModule
+internal class NullTestModule : ITestModule
{
- public string Name { get; } = name;
+ public static readonly NullTestModule Instance = new();
- public DateTimeOffset StartTime { get; } = startDate ?? DateTimeOffset.UtcNow;
+ private NullTestModule()
+ {
+ }
+
+ public string Name => "Undefined";
+
+ public DateTimeOffset StartTime => default;
- public string? Framework { get; } = framework;
+ public string? Framework => null;
public void SetTag(string key, string? value)
{
@@ -41,9 +47,7 @@ public void Close(TimeSpan? duration)
public Task CloseAsync(TimeSpan? duration) => Task.CompletedTask;
- public ITestSuite GetOrCreateSuite(string name)
- => new NullTestSuite(this, name, null);
+ public ITestSuite GetOrCreateSuite(string name) => NullTestSuite.Instance;
- public ITestSuite GetOrCreateSuite(string name, DateTimeOffset? startDate)
- => new NullTestSuite(this, name, startDate);
+ public ITestSuite GetOrCreateSuite(string name, DateTimeOffset? startDate) => NullTestSuite.Instance;
}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSession.cs b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSession.cs
index 66d35bac1740..5b05c4603d03 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSession.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSession.cs
@@ -3,19 +3,19 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
//
-#nullable enable
-
namespace Datadog.Trace.Ci.Stubs;
-internal class NullTestSession(string? command, string? workingDirectory, string? framework, DateTimeOffset? startDate) : ITestSession
+internal class NullTestSession : ITestSession
{
- public string? Command { get; } = command;
+ public static readonly NullTestSession Instance = new();
+
+ public string? Command => null;
- public string? WorkingDirectory { get; } = workingDirectory;
+ public string? WorkingDirectory => null;
- public DateTimeOffset StartTime { get; } = startDate ?? DateTimeOffset.UtcNow;
+ public DateTimeOffset StartTime => default;
- public string? Framework { get; } = framework;
+ public string? Framework => null;
public void SetTag(string key, string? value)
{
@@ -45,12 +45,12 @@ public void Close(TestStatus status, TimeSpan? duration)
public Task CloseAsync(TestStatus status, TimeSpan? duration) => Task.CompletedTask;
- public ITestModule CreateModule(string name)
- => new NullTestModule(name, null, null);
+ ITestModule ITestSession.CreateModule(string name)
+ => NullTestModule.Instance;
- public ITestModule CreateModule(string name, string framework, string frameworkVersion)
- => new NullTestModule(name, framework, null);
+ ITestModule ITestSession.CreateModule(string name, string framework, string frameworkVersion)
+ => NullTestModule.Instance;
- public ITestModule CreateModule(string name, string framework, string frameworkVersion, DateTimeOffset startDate)
- => new NullTestModule(name, framework, startDate);
+ ITestModule ITestSession.CreateModule(string name, string framework, string frameworkVersion, DateTimeOffset startDate)
+ => NullTestModule.Instance;
}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSuite.cs b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSuite.cs
index 7047e45d3b21..dd49d4320151 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSuite.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/Stubs/NullTestSuite.cs
@@ -3,17 +3,21 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
//
-#nullable enable
-
namespace Datadog.Trace.Ci.Stubs;
-internal class NullTestSuite(ITestModule module, string name, DateTimeOffset? startDate) : ITestSuite
+internal class NullTestSuite : ITestSuite
{
- public string Name { get; } = name;
+ public static readonly NullTestSuite Instance = new();
+
+ private NullTestSuite()
+ {
+ }
+
+ public string Name => "Undefined";
- public DateTimeOffset StartTime { get; } = startDate ?? DateTimeOffset.UtcNow;
+ public DateTimeOffset StartTime => default;
- public ITestModule Module { get; } = module;
+ public ITestModule Module => NullTestModule.Instance;
public void SetTag(string key, string? value)
{
@@ -40,8 +44,8 @@ public void Close(TimeSpan? duration)
}
public ITest CreateTest(string name)
- => new NullTest(this, name, null);
+ => NullTest.Instance;
public ITest CreateTest(string name, DateTimeOffset startDate)
- => new NullTest(this, name, startDate);
+ => NullTest.Instance;
}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/TestExtensions.cs b/tracer/src/Datadog.Trace.Manual/Ci/TestExtensions.cs
new file mode 100644
index 000000000000..3bbe9b15b412
--- /dev/null
+++ b/tracer/src/Datadog.Trace.Manual/Ci/TestExtensions.cs
@@ -0,0 +1,47 @@
+//
+// 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.
+//
+
+using Datadog.Trace.SourceGenerators;
+
+namespace Datadog.Trace.Ci;
+
+///
+/// Extension methods for adding data to instances
+///
+public static class TestExtensions
+{
+ ///
+ /// Set Test parameters
+ ///
+ /// The instance to augment
+ /// TestParameters instance
+ [Instrumented]
+ public static void SetParameters(this ITest test, TestParameters parameters)
+ {
+ }
+
+ ///
+ /// Set benchmark metadata
+ ///
+ /// The instance to augment
+ /// Host info
+ /// Job info
+ [Instrumented]
+ public static void SetBenchmarkMetadata(this ITest test, in BenchmarkHostInfo hostInfo, in BenchmarkJobInfo jobInfo)
+ {
+ }
+
+ ///
+ /// Add benchmark data
+ ///
+ /// The instance to augment
+ /// Measure type
+ /// Measure info
+ /// Statistics values
+ [Instrumented]
+ public static void AddBenchmarkData(this ITest test, BenchmarkMeasureType measureType, string info, in BenchmarkDiscreteStats statistics)
+ {
+ }
+}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/TestModule.cs b/tracer/src/Datadog.Trace.Manual/Ci/TestModule.cs
index af512e8c57e9..fb28303a9daa 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/TestModule.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/TestModule.cs
@@ -45,5 +45,5 @@ public static ITestModule Create(string name, string framework, string framework
[Instrumented]
internal static ITestModule InternalCreate(string name, string? framework, string? frameworkVersion, DateTimeOffset? startDate)
- => new NullTestModule(name, framework, startDate);
+ => NullTestModule.Instance;
}
diff --git a/tracer/src/Datadog.Trace.Manual/Ci/TestSession.cs b/tracer/src/Datadog.Trace.Manual/Ci/TestSession.cs
index b90b04aeda30..24e4a3e202b4 100644
--- a/tracer/src/Datadog.Trace.Manual/Ci/TestSession.cs
+++ b/tracer/src/Datadog.Trace.Manual/Ci/TestSession.cs
@@ -66,5 +66,5 @@ public static ITestSession GetOrCreate(string command, string? workingDirectory,
[Instrumented]
internal static ITestSession InternalGetOrCreate(string command, string? workingDirectory, string? framework, DateTimeOffset? startDate, bool propagateEnvironmentVariables = false)
- => new NullTestSession(command, workingDirectory, framework, startDate);
+ => NullTestSession.Instance;
}
diff --git a/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettings.cs b/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettings.cs
index 00f94a07353b..7cbd72a82c90 100644
--- a/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettings.cs
+++ b/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettings.cs
@@ -3,6 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
//
+using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation;
using Datadog.Trace.SourceGenerators;
namespace Datadog.Trace.Configuration;
@@ -12,19 +13,16 @@ namespace Datadog.Trace.Configuration;
///
public sealed class IntegrationSettings
{
- private readonly bool? _enabledInitial;
- private readonly bool? _analyticsEnabledInitial;
- private readonly double _analyticsSampleRateInitial;
- private OverrideValue _enabledOverride = new();
- private OverrideValue _analyticsEnabledOverride = new();
- private OverrideValue _analyticsSampleRateOverride = new();
+ private OverrideValue _enabled;
+ private OverrideValue _analyticsEnabled;
+ private OverrideValue _analyticsSampleRate;
internal IntegrationSettings(string integrationName, bool? enabled, bool? analyticsEnabled, double analyticsSampleRate)
{
IntegrationName = integrationName;
- _enabledInitial = enabled;
- _analyticsEnabledInitial = analyticsEnabled;
- _analyticsSampleRateInitial = analyticsSampleRate;
+ _enabled = new(enabled);
+ _analyticsEnabled = new(analyticsEnabled);
+ _analyticsSampleRate = new(analyticsSampleRate);
}
///
@@ -40,8 +38,8 @@ internal IntegrationSettings(string integrationName, bool? enabled, bool? analyt
public bool? Enabled
{
[Instrumented]
- get => _enabledOverride.IsOverridden ? _enabledOverride.Value : _enabledInitial;
- set => _enabledOverride = new(value);
+ get => _enabled.Value;
+ set => _enabled = _enabled.Override(value);
}
///
@@ -51,8 +49,8 @@ public bool? Enabled
public bool? AnalyticsEnabled
{
[Instrumented]
- get => _analyticsEnabledOverride.IsOverridden ? _analyticsEnabledOverride.Value : _analyticsEnabledInitial;
- set => _analyticsEnabledOverride = new(value);
+ get => _analyticsEnabled.Value;
+ set => _analyticsEnabled = _analyticsEnabled.Override(value);
}
///
@@ -62,33 +60,19 @@ public bool? AnalyticsEnabled
public double AnalyticsSampleRate
{
[Instrumented]
- get => _analyticsSampleRateOverride.IsOverridden ? _analyticsSampleRateOverride.Value : _analyticsSampleRateInitial;
- set => _analyticsSampleRateOverride = new(value);
+ get => _analyticsSampleRate.Value;
+ set => _analyticsSampleRate = _analyticsSampleRate.Override(value);
}
///
/// "Serializes" the values, if changed, to an array. If there are no updates, returns null
///
internal object?[]? GetChangeDetails()
- {
- if (_enabledOverride.IsOverridden || _analyticsEnabledOverride.IsOverridden || _analyticsSampleRateOverride.IsOverridden)
- {
- // we have changes, record everything
- // Yes, this is a lot of boxing :(
- var results = new object?[6];
- results[0] = _enabledOverride.IsOverridden;
- results[1] = _enabledOverride.IsOverridden ? _enabledOverride.Value : null;
-
- results[2] = _analyticsEnabledOverride.IsOverridden;
- results[3] = _analyticsEnabledOverride.IsOverridden ? _analyticsEnabledOverride.Value : null;
-
- results[4] = _analyticsSampleRateOverride.IsOverridden;
- results[5] = _analyticsSampleRateOverride.IsOverridden ? _analyticsSampleRateOverride.Value : null;
-
- return results;
- }
-
- // no changes
- return null;
- }
+ => IntegrationSettingsSerializationHelper.SerializeFromManual(
+ _enabled.IsOverridden,
+ _enabled.IsOverridden ? _enabled.Value : null,
+ _analyticsEnabled.IsOverridden,
+ _analyticsEnabled.IsOverridden ? _analyticsEnabled.Value : null,
+ _analyticsSampleRate.IsOverridden,
+ _analyticsSampleRate.IsOverridden ? _analyticsSampleRate.Value : null);
}
diff --git a/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettingsHelper.cs b/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettingsHelper.cs
index dd6bae78dfe9..b1b2f2f44838 100644
--- a/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettingsHelper.cs
+++ b/tracer/src/Datadog.Trace.Manual/Configuration/IntegrationSettingsHelper.cs
@@ -16,7 +16,7 @@ public static IntegrationSettingsCollection ParseFromAutomatic(Dictionary new(name, enabled, analyticsEnabled, analyticsSampleRate);
}
@@ -25,7 +25,7 @@ public static ImmutableIntegrationSettingsCollection ParseImmutableFromAutomatic
var settings = Populate(initialValues, CreateSettingFunc);
return new ImmutableIntegrationSettingsCollection(settings);
- ImmutableIntegrationSettings CreateSettingFunc(string name, bool? enabled, bool? analyticsEnabled, double analyticsSampleRate)
+ static ImmutableIntegrationSettings CreateSettingFunc(string name, bool? enabled, bool? analyticsEnabled, double analyticsSampleRate)
=> new(name, enabled, analyticsEnabled, analyticsSampleRate);
}
@@ -43,8 +43,11 @@ private static Dictionary Populate(
var settings = new Dictionary(fromAutomatic.Count, StringComparer.OrdinalIgnoreCase);
foreach (var setting in fromAutomatic)
{
- var values = setting.Value;
- if (values.Length < 3)
+ if (!IntegrationSettingsSerializationHelper.TryDeserializeFromAutomatic(
+ setting.Value,
+ out var enabled,
+ out var analyticsEnabled,
+ out var analyticsSampleRate))
{
// this will never happen unless there's a bad version mismatch issue, so just bail out
return new();
@@ -54,9 +57,9 @@ private static Dictionary Populate(
setting.Key,
createSettingFunc(
setting.Key,
- values[0] as bool?,
- values[1] as bool?,
- values[2] as double? ?? 1.0));
+ enabled,
+ analyticsEnabled,
+ analyticsSampleRate));
}
return settings;
diff --git a/tracer/src/Datadog.Trace.Manual/Configuration/OverrideValue.cs b/tracer/src/Datadog.Trace.Manual/Configuration/OverrideValue.cs
index 67ac948651b2..6042c33b6882 100644
--- a/tracer/src/Datadog.Trace.Manual/Configuration/OverrideValue.cs
+++ b/tracer/src/Datadog.Trace.Manual/Configuration/OverrideValue.cs
@@ -9,18 +9,27 @@ namespace Datadog.Trace.Configuration;
internal readonly struct OverrideValue
{
- public readonly T Value;
+ public readonly T Initial;
public readonly bool IsOverridden;
- public OverrideValue(T value)
+ private readonly T _override;
+
+ public OverrideValue(T initial)
{
- Value = value;
- IsOverridden = true;
+ Initial = initial;
+ _override = default!;
+ IsOverridden = false;
}
- public OverrideValue()
+ public OverrideValue(T initial, T @override)
{
- Value = default!;
- IsOverridden = false;
+ Initial = initial;
+ _override = @override;
+ IsOverridden = true;
}
+
+ public T Value => IsOverridden ? _override : Initial;
+
+ public OverrideValue Override(T value)
+ => new(Initial, value);
}
diff --git a/tracer/src/Datadog.Trace.Manual/Configuration/TracerSettings.cs b/tracer/src/Datadog.Trace.Manual/Configuration/TracerSettings.cs
index 00a3ba2c74e3..00edc3251bc2 100644
--- a/tracer/src/Datadog.Trace.Manual/Configuration/TracerSettings.cs
+++ b/tracer/src/Datadog.Trace.Manual/Configuration/TracerSettings.cs
@@ -15,45 +15,27 @@ namespace Datadog.Trace.Configuration;
///
public sealed class TracerSettings
{
- private readonly bool _diagnosticSourceEnabledInitial;
- private readonly string? _environmentInitial;
- private readonly string? _serviceNameInitial;
- private readonly string? _serviceVersionInitial;
- private readonly bool _analyticsEnabledInitial;
- private readonly double? _globalSamplingRateInitial;
- private readonly IDictionary _globalTagsInitial;
- private readonly IDictionary _grpcTagsInitial;
- private readonly IDictionary _headerTagsInitial;
- private readonly bool _kafkaCreateConsumerScopeEnabledInitial;
- private readonly bool _logsInjectionEnabledInitial;
- private readonly int _maxTracesSubmittedPerSecondInitial;
- private readonly string? _customSamplingRulesInitial;
- private readonly bool _startupDiagnosticLogEnabledInitial;
- private readonly bool _traceEnabledInitial;
- private readonly HashSet _disabledIntegrationNamesInitial;
- private readonly bool _tracerMetricsEnabledInitial;
- private readonly bool _statsComputationEnabledInitial;
- private readonly Uri _agentUriInitial;
+ private readonly bool _diagnosticSourceEnabled;
private readonly bool _isFromDefaultSources;
- private OverrideValue _environmentOverride = new();
- private OverrideValue _serviceNameOverride = new();
- private OverrideValue _serviceVersionOverride = new();
- private OverrideValue _analyticsEnabledOverride = new();
- private OverrideValue _globalSamplingRateOverride = new();
- private IDictionary _globalTagsOverride;
- private IDictionary _grpcTagsOverride;
- private IDictionary _headerTagsOverride;
- private OverrideValue _kafkaCreateConsumerScopeEnabledOverride = new();
- private OverrideValue _logsInjectionEnabledOverride = new();
- private OverrideValue _maxTracesSubmittedPerSecondOverride = new();
- private OverrideValue _customSamplingRulesOverride = new();
- private OverrideValue _startupDiagnosticLogEnabledOverride = new();
- private OverrideValue _traceEnabledOverride = new();
- private HashSet _disabledIntegrationNamesOverride;
- private OverrideValue _tracerMetricsEnabledOverride = new();
- private OverrideValue _statsComputationEnabledOverride = new();
- private OverrideValue _agentUriOverride = new();
+ private OverrideValue _environment;
+ private OverrideValue _serviceName;
+ private OverrideValue _serviceVersion;
+ private OverrideValue _analyticsEnabled;
+ private OverrideValue _globalSamplingRate;
+ private OverrideValue> _globalTags;
+ private OverrideValue> _grpcTags;
+ private OverrideValue> _headerTags;
+ private OverrideValue _kafkaCreateConsumerScopeEnabled;
+ private OverrideValue _logsInjectionEnabled;
+ private OverrideValue _maxTracesSubmittedPerSecond;
+ private OverrideValue _customSamplingRules;
+ private OverrideValue _startupDiagnosticLogEnabled;
+ private OverrideValue _traceEnabled;
+ private OverrideValue> _disabledIntegrationNames;
+ private OverrideValue _tracerMetricsEnabled;
+ private OverrideValue _statsComputationEnabled;
+ private OverrideValue _agentUri;
private List? _httpClientErrorCodes;
private List? _httpServerErrorCodes;
private Dictionary? _serviceNameMappings;
@@ -88,33 +70,27 @@ internal TracerSettings(Dictionary initialValues, bool isFromDe
{
// The values set here represent the defaults when there's no auto-instrumentation
// We don't care too much if they get out of sync because that's not supported anyway
- _agentUriInitial = GetValue(initialValues, TracerSettingKeyConstants.AgentUriKey, null) ?? new Uri("http://127.0.0.1:8126");
- _analyticsEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.AnalyticsEnabledKey, false);
- _customSamplingRulesInitial = GetValue(initialValues, TracerSettingKeyConstants.CustomSamplingRules, null);
- _disabledIntegrationNamesInitial = GetValue?>(initialValues, TracerSettingKeyConstants.DisabledIntegrationNamesKey, null) ?? [];
- _diagnosticSourceEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.DiagnosticSourceEnabledKey, false);
- _environmentInitial = GetValue(initialValues, TracerSettingKeyConstants.EnvironmentKey, null);
- _globalSamplingRateInitial = GetValue(initialValues, TracerSettingKeyConstants.GlobalSamplingRateKey, null);
- _globalTagsInitial = GetValue?>(initialValues, TracerSettingKeyConstants.GlobalTagsKey, null) ?? new ConcurrentDictionary();
- _grpcTagsInitial = GetValue?>(initialValues, TracerSettingKeyConstants.GrpcTags, null) ?? new ConcurrentDictionary();
- _headerTagsInitial = GetValue?>(initialValues, TracerSettingKeyConstants.HeaderTags, null) ?? new ConcurrentDictionary();
- _kafkaCreateConsumerScopeEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey, true);
- _logsInjectionEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.LogsInjectionEnabledKey, false);
- _maxTracesSubmittedPerSecondInitial = GetValue(initialValues, TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey, 100);
- _serviceNameInitial = GetValue(initialValues, TracerSettingKeyConstants.ServiceNameKey, null);
- _serviceVersionInitial = GetValue(initialValues, TracerSettingKeyConstants.ServiceVersionKey, null);
- _startupDiagnosticLogEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey, true);
- _statsComputationEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.StatsComputationEnabledKey, true);
- _traceEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.TraceEnabledKey, true);
- _tracerMetricsEnabledInitial = GetValue(initialValues, TracerSettingKeyConstants.TracerMetricsEnabledKey, false);
+ _agentUri = TryGetValue(initialValues, TracerSettingKeyConstants.AgentUriKey) ?? new OverrideValue(new Uri("http://127.0.0.1:8126"));
+ _analyticsEnabled = GetValue(initialValues, TracerSettingKeyConstants.AnalyticsEnabledKey, false);
+ _customSamplingRules = GetValue(initialValues, TracerSettingKeyConstants.CustomSamplingRules, null);
+ _disabledIntegrationNames = GetAsHashSet(initialValues, TracerSettingKeyConstants.DisabledIntegrationNamesKey);
+ _diagnosticSourceEnabled = GetValue(initialValues, TracerSettingKeyConstants.DiagnosticSourceEnabledKey, false).Value;
+ _environment = GetValue(initialValues, TracerSettingKeyConstants.EnvironmentKey, null);
+ _globalSamplingRate = GetValue(initialValues, TracerSettingKeyConstants.GlobalSamplingRateKey, null);
+ _globalTags = GetAsDictionary(initialValues, TracerSettingKeyConstants.GlobalTagsKey);
+ _grpcTags = GetAsDictionary(initialValues, TracerSettingKeyConstants.GrpcTags);
+ _headerTags = GetAsDictionary(initialValues, TracerSettingKeyConstants.HeaderTags);
+ _kafkaCreateConsumerScopeEnabled = GetValue(initialValues, TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey, true);
+ _logsInjectionEnabled = GetValue(initialValues, TracerSettingKeyConstants.LogsInjectionEnabledKey, false);
+ _maxTracesSubmittedPerSecond = GetValue(initialValues, TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey, 100);
+ _serviceName = GetValue(initialValues, TracerSettingKeyConstants.ServiceNameKey, null);
+ _serviceVersion = GetValue(initialValues, TracerSettingKeyConstants.ServiceVersionKey, null);
+ _startupDiagnosticLogEnabled = GetValue(initialValues, TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey, true);
+ _statsComputationEnabled = GetValue(initialValues, TracerSettingKeyConstants.StatsComputationEnabledKey, true);
+ _traceEnabled = GetValue(initialValues, TracerSettingKeyConstants.TraceEnabledKey, true);
+ _tracerMetricsEnabled = GetValue(initialValues, TracerSettingKeyConstants.TracerMetricsEnabledKey, false);
_isFromDefaultSources = isFromDefaultSources;
- // we copy these so we can detect changes later (including replacement)
- _globalTagsOverride = new ConcurrentDictionary(_globalTagsInitial);
- _disabledIntegrationNamesOverride = new HashSet(_disabledIntegrationNamesInitial);
- _grpcTagsOverride = new ConcurrentDictionary(_grpcTagsInitial);
- _headerTagsOverride = new ConcurrentDictionary(_headerTagsInitial);
-
// This is just a bunch of indirection to not change the public API for now
#pragma warning disable CS0618 // Type or member is obsolete
Exporter = new ExporterSettings(this);
@@ -122,15 +98,36 @@ internal TracerSettings(Dictionary initialValues, bool isFromDe
Integrations = IntegrationSettingsHelper.ParseFromAutomatic(initialValues);
- static T GetValue(Dictionary results, string key, T defaultValue)
+ static OverrideValue> GetAsHashSet(Dictionary results, string key)
+ {
+ var initial = TryGetValue?>(results, key);
+ // we copy these so we can detect changes later (including replacement)
+ return initial?.Value is { } value
+ ? new OverrideValue>(value, @override: new HashSet(value))
+ : new OverrideValue>(initial: null!, new HashSet());
+ }
+
+ static OverrideValue> GetAsDictionary(Dictionary results, string key)
+ {
+ var initial = TryGetValue?>(results, key);
+ // we copy these so we can detect changes later (including replacement)
+ return initial?.Value is { } value
+ ? new OverrideValue>(value, @override: new ConcurrentDictionary(value))
+ : new OverrideValue>(initial: null!, new ConcurrentDictionary());
+ }
+
+ static OverrideValue GetValue(Dictionary results, string key, T defaultValue)
+ => TryGetValue(results, key) ?? new OverrideValue(defaultValue);
+
+ static OverrideValue? TryGetValue(Dictionary results, string key)
{
if (results.TryGetValue(key, out var value)
&& value is T t)
{
- return t;
+ return new OverrideValue(t);
}
- return defaultValue;
+ return null;
}
}
@@ -147,7 +144,7 @@ static T GetValue(Dictionary results, string key, T defaultV
[Instrumented]
public bool DiagnosticSourceEnabled
{
- get => _diagnosticSourceEnabledInitial;
+ get => _diagnosticSourceEnabled;
[Obsolete("This value cannot be set in code. Instead, set it using the DD_DIAGNOSTIC_SOURCE_ENABLED environment variable, or in configuration files")]
set
@@ -164,8 +161,8 @@ public bool DiagnosticSourceEnabled
public string? Environment
{
[Instrumented]
- get => _environmentOverride.IsOverridden ? _environmentOverride.Value : _environmentInitial;
- set => _environmentOverride = new(value);
+ get => _environment.Value;
+ set => _environment = _environment.Override(value);
}
///
@@ -175,8 +172,8 @@ public string? Environment
public string? ServiceName
{
[Instrumented]
- get => _serviceNameOverride.IsOverridden ? _serviceNameOverride.Value : _serviceNameInitial;
- set => _serviceNameOverride = new(value);
+ get => _serviceName.Value;
+ set => _serviceName = _serviceName.Override(value);
}
///
@@ -185,8 +182,8 @@ public string? ServiceName
public string? ServiceVersion
{
[Instrumented]
- get => _serviceVersionOverride.IsOverridden ? _serviceVersionOverride.Value : _serviceVersionInitial;
- set => _serviceVersionOverride = new(value);
+ get => _serviceVersion.Value;
+ set => _serviceVersion = _serviceVersion.Override(value);
}
///
@@ -199,8 +196,8 @@ public string? ServiceVersion
public bool AnalyticsEnabled
{
[Instrumented]
- get => _analyticsEnabledOverride.IsOverridden ? _analyticsEnabledOverride.Value : _analyticsEnabledInitial;
- set => _analyticsEnabledOverride = new(value);
+ get => _analyticsEnabled.Value;
+ set => _analyticsEnabled = _analyticsEnabled.Override(value);
}
///
@@ -209,8 +206,8 @@ public bool AnalyticsEnabled
public double? GlobalSamplingRate
{
[Instrumented]
- get => _globalSamplingRateOverride.IsOverridden ? _globalSamplingRateOverride.Value : _globalSamplingRateInitial;
- set => _globalSamplingRateOverride = new(value);
+ get => _globalSamplingRate.Value;
+ set => _globalSamplingRate = _globalSamplingRate.Override(value);
}
///
@@ -219,8 +216,8 @@ public double? GlobalSamplingRate
public IDictionary GlobalTags
{
[Instrumented]
- get => _globalTagsOverride;
- set => _globalTagsOverride = value;
+ get => _globalTags.Value;
+ set => _globalTags = _globalTags.Override(value);
}
///
@@ -230,8 +227,8 @@ public IDictionary GlobalTags
public IDictionary GrpcTags
{
[Instrumented]
- get => _grpcTagsOverride;
- set => _grpcTagsOverride = value;
+ get => _grpcTags.Value;
+ set => _grpcTags = _grpcTags.Override(value);
}
///
@@ -241,8 +238,8 @@ public IDictionary GrpcTags
public IDictionary HeaderTags
{
[Instrumented]
- get => _headerTagsOverride;
- set => _headerTagsOverride = value;
+ get => _headerTags.Value;
+ set => _headerTags = _headerTags.Override(value);
}
///
@@ -252,8 +249,8 @@ public IDictionary HeaderTags
public bool KafkaCreateConsumerScopeEnabled
{
[Instrumented]
- get => _kafkaCreateConsumerScopeEnabledOverride.IsOverridden ? _kafkaCreateConsumerScopeEnabledOverride.Value : _kafkaCreateConsumerScopeEnabledInitial;
- set => _kafkaCreateConsumerScopeEnabledOverride = new(value);
+ get => _kafkaCreateConsumerScopeEnabled.Value;
+ set => _kafkaCreateConsumerScopeEnabled = _kafkaCreateConsumerScopeEnabled.Override(value);
}
///
@@ -264,8 +261,8 @@ public bool KafkaCreateConsumerScopeEnabled
public bool LogsInjectionEnabled
{
[Instrumented]
- get => _logsInjectionEnabledOverride.IsOverridden ? _logsInjectionEnabledOverride.Value : _logsInjectionEnabledInitial;
- set => _logsInjectionEnabledOverride = new(value);
+ get => _logsInjectionEnabled.Value;
+ set => _logsInjectionEnabled = _logsInjectionEnabled.Override(value);
}
///
@@ -275,8 +272,8 @@ public bool LogsInjectionEnabled
public int MaxTracesSubmittedPerSecond
{
[Instrumented]
- get => _maxTracesSubmittedPerSecondOverride.IsOverridden ? _maxTracesSubmittedPerSecondOverride.Value : _maxTracesSubmittedPerSecondInitial;
- set => _maxTracesSubmittedPerSecondOverride = new(value);
+ get => _maxTracesSubmittedPerSecond.Value;
+ set => _maxTracesSubmittedPerSecond = _maxTracesSubmittedPerSecond.Override(value);
}
///
@@ -285,8 +282,8 @@ public int MaxTracesSubmittedPerSecond
public string? CustomSamplingRules
{
[Instrumented]
- get => _customSamplingRulesOverride.IsOverridden ? _customSamplingRulesOverride.Value : _customSamplingRulesInitial;
- set => _customSamplingRulesOverride = new(value);
+ get => _customSamplingRules.Value;
+ set => _customSamplingRules = _customSamplingRules.Override(value);
}
///
@@ -295,8 +292,8 @@ public string? CustomSamplingRules
public bool StartupDiagnosticLogEnabled
{
[Instrumented]
- get => _startupDiagnosticLogEnabledOverride.IsOverridden ? _startupDiagnosticLogEnabledOverride.Value : _startupDiagnosticLogEnabledInitial;
- set => _startupDiagnosticLogEnabledOverride = new(value);
+ get => _startupDiagnosticLogEnabled.Value;
+ set => _startupDiagnosticLogEnabled = _startupDiagnosticLogEnabled.Override(value);
}
///
@@ -306,8 +303,8 @@ public bool StartupDiagnosticLogEnabled
public bool TraceEnabled
{
[Instrumented]
- get => _traceEnabledOverride.IsOverridden ? _traceEnabledOverride.Value : _traceEnabledInitial;
- set => _traceEnabledOverride = new(value);
+ get => _traceEnabled.Value;
+ set => _traceEnabled = _traceEnabled.Override(value);
}
///
@@ -316,8 +313,8 @@ public bool TraceEnabled
public HashSet DisabledIntegrationNames
{
[Instrumented]
- get => _disabledIntegrationNamesOverride;
- set => _disabledIntegrationNamesOverride = value;
+ get => _disabledIntegrationNames.Value;
+ set => _disabledIntegrationNames = _disabledIntegrationNames.Override(value);
}
///
@@ -327,8 +324,8 @@ public HashSet DisabledIntegrationNames
public bool TracerMetricsEnabled
{
[Instrumented]
- get => _tracerMetricsEnabledOverride.IsOverridden ? _tracerMetricsEnabledOverride.Value : _tracerMetricsEnabledInitial;
- set => _tracerMetricsEnabledOverride = new(value);
+ get => _tracerMetricsEnabled.Value;
+ set => _tracerMetricsEnabled = _tracerMetricsEnabled.Override(value);
}
///
@@ -337,8 +334,8 @@ public bool TracerMetricsEnabled
public bool StatsComputationEnabled
{
[Instrumented]
- get => _statsComputationEnabledOverride.IsOverridden ? _statsComputationEnabledOverride.Value : _statsComputationEnabledInitial;
- set => _statsComputationEnabledOverride = new(value);
+ get => _statsComputationEnabled.Value;
+ set => _statsComputationEnabled = _statsComputationEnabled.Override(value);
}
///
@@ -348,8 +345,8 @@ public bool StatsComputationEnabled
public Uri AgentUri
{
[Instrumented]
- get => _agentUriOverride.IsOverridden ? _agentUriOverride.Value : _agentUriInitial;
- set => _agentUriOverride = new(value);
+ get => _agentUri.Value;
+ set => _agentUri = _agentUri.Override(value);
}
///
@@ -435,31 +432,26 @@ public void SetServiceNameMappings(IEnumerable> map
// Could probably source gen this if we can be bothered
var results = new Dictionary();
- AddIfChanged(results, TracerSettingKeyConstants.AgentUriKey, _agentUriOverride);
- AddIfChanged(results, TracerSettingKeyConstants.AnalyticsEnabledKey, _analyticsEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.EnvironmentKey, _environmentOverride);
- AddIfChanged(results, TracerSettingKeyConstants.CustomSamplingRules, _customSamplingRulesOverride);
- AddIfChanged(results, TracerSettingKeyConstants.GlobalSamplingRateKey, _globalSamplingRateOverride);
- AddIfChanged(results, TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey, _kafkaCreateConsumerScopeEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.LogsInjectionEnabledKey, _logsInjectionEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey, _maxTracesSubmittedPerSecondOverride);
- AddIfChanged(results, TracerSettingKeyConstants.ServiceNameKey, _serviceNameOverride);
- AddIfChanged(results, TracerSettingKeyConstants.ServiceVersionKey, _serviceVersionOverride);
- AddIfChanged(results, TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey, _startupDiagnosticLogEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.StatsComputationEnabledKey, _statsComputationEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.TraceEnabledKey, _traceEnabledOverride);
- AddIfChanged(results, TracerSettingKeyConstants.TracerMetricsEnabledKey, _tracerMetricsEnabledOverride);
+ AddIfChanged(results, TracerSettingKeyConstants.AgentUriKey, _agentUri);
+ AddIfChanged(results, TracerSettingKeyConstants.AnalyticsEnabledKey, _analyticsEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.EnvironmentKey, _environment);
+ AddIfChanged(results, TracerSettingKeyConstants.CustomSamplingRules, _customSamplingRules);
+ AddIfChanged(results, TracerSettingKeyConstants.GlobalSamplingRateKey, _globalSamplingRate);
+ AddIfChanged(results, TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey, _kafkaCreateConsumerScopeEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.LogsInjectionEnabledKey, _logsInjectionEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey, _maxTracesSubmittedPerSecond);
+ AddIfChanged(results, TracerSettingKeyConstants.ServiceNameKey, _serviceName);
+ AddIfChanged(results, TracerSettingKeyConstants.ServiceVersionKey, _serviceVersion);
+ AddIfChanged(results, TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey, _startupDiagnosticLogEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.StatsComputationEnabledKey, _statsComputationEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.TraceEnabledKey, _traceEnabled);
+ AddIfChanged(results, TracerSettingKeyConstants.TracerMetricsEnabledKey, _tracerMetricsEnabled);
// We have to check if any of the tags have changed
- AddChangedDictionary(results, TracerSettingKeyConstants.GlobalTagsKey, _globalTagsOverride, _globalTagsInitial);
- AddChangedDictionary(results, TracerSettingKeyConstants.GrpcTags, _grpcTagsOverride, _grpcTagsInitial);
- AddChangedDictionary(results, TracerSettingKeyConstants.HeaderTags, _headerTagsOverride, _headerTagsInitial);
-
- if (_disabledIntegrationNamesInitial.Count != _disabledIntegrationNamesOverride.Count
- || !_disabledIntegrationNamesOverride.SetEquals(_disabledIntegrationNamesInitial))
- {
- results.Add(TracerSettingKeyConstants.DisabledIntegrationNamesKey, _disabledIntegrationNamesOverride);
- }
+ AddIfChangedDictionary(results, TracerSettingKeyConstants.GlobalTagsKey, _globalTags);
+ AddIfChangedDictionary(results, TracerSettingKeyConstants.GrpcTags, _grpcTags);
+ AddIfChangedDictionary(results, TracerSettingKeyConstants.HeaderTags, _headerTags);
+ AddIfChangedHashSet(results, TracerSettingKeyConstants.DisabledIntegrationNamesKey, _disabledIntegrationNames);
// These are write-only, so only send them if we have them
if (_serviceNameMappings is not null)
@@ -479,11 +471,14 @@ public void SetServiceNameMappings(IEnumerable> map
// Always set
results[TracerSettingKeyConstants.IsFromDefaultSourcesKey] = _isFromDefaultSources;
- results[TracerSettingKeyConstants.IntegrationSettingsKey] = BuildIntegrationSettings(Integrations);
+ if (BuildIntegrationSettings(Integrations) is { } integrations)
+ {
+ results[TracerSettingKeyConstants.IntegrationSettingsKey] = integrations;
+ }
return results;
- static void AddIfChanged(Dictionary results, string key, OverrideValue updated)
+ static void AddIfChanged(Dictionary results, string key, in OverrideValue updated)
{
if (updated.IsOverridden)
{
@@ -491,28 +486,59 @@ static void AddIfChanged(Dictionary results, string key, Ove
}
}
- static void AddChangedDictionary(Dictionary results, string key, IDictionary updated, IDictionary initial)
+ static void AddIfChangedHashSet(Dictionary results, string key, in OverrideValue> updated)
{
- if (HasChanges(initial, updated))
+ // we always have an override, but are they the same?
+ var initial = updated.Initial;
+ var value = updated.Value;
+
+ if (initial is null)
{
- results[key] = updated;
+ if (value.Count != 0)
+ {
+ results.Add(key, value);
+ }
+ }
+ else
+ {
+ if ((initial.Count != value.Count) || !initial.SetEquals(value))
+ {
+ results.Add(key, value);
+ }
+ }
+ }
+
+ static void AddIfChangedDictionary(Dictionary results, string key, in OverrideValue> updated)
+ {
+ if (HasChanges(in updated))
+ {
+ results[key] = updated.Value;
}
return;
- static bool HasChanges(IDictionary initial, IDictionary updated)
+ static bool HasChanges(in OverrideValue> updated)
{
+ // initial could be null, but value is never null
+ var initial = updated.Initial;
+ var value = updated.Value;
+
// Currently need to account for customers _replacing_ the Global Tags as well as changing it
- // we create the updated one as a concurrent dictionary, so if they change it
- if (initial.Count != updated.Count || updated is not ConcurrentDictionary)
+ // we create the updated one as a concurrent dictionary, so if it's not any more, then we know they've replaced it
+ if (value is not ConcurrentDictionary || (initial?.Count ?? 0) != value.Count)
{
return true;
}
+ if (initial is null)
+ {
+ return value.Count != 0;
+ }
+
var comparer = StringComparer.Ordinal;
foreach (var kvp in initial)
{
- if (!updated.TryGetValue(kvp.Key, out var value2)
+ if (!value.TryGetValue(kvp.Key, out var value2)
|| !comparer.Equals(kvp.Value, value2))
{
return true;
diff --git a/tracer/src/Datadog.Trace.Manual/Datadog.Trace.Manual.csproj b/tracer/src/Datadog.Trace.Manual/Datadog.Trace.Manual.csproj
index b999bde26759..1800e12c1e04 100644
--- a/tracer/src/Datadog.Trace.Manual/Datadog.Trace.Manual.csproj
+++ b/tracer/src/Datadog.Trace.Manual/Datadog.Trace.Manual.csproj
@@ -18,13 +18,16 @@
-
+
+
+
+
diff --git a/tracer/src/Datadog.Trace.Manual/Stubs/NullScope.cs b/tracer/src/Datadog.Trace.Manual/Stubs/NullScope.cs
index 1b7fb101d1e8..782b63d81741 100644
--- a/tracer/src/Datadog.Trace.Manual/Stubs/NullScope.cs
+++ b/tracer/src/Datadog.Trace.Manual/Stubs/NullScope.cs
@@ -9,7 +9,11 @@ internal class NullScope : IScope
{
public static readonly NullScope Instance = new();
- public ISpan Span { get; } = NullSpan.Instance;
+ private NullScope()
+ {
+ }
+
+ public ISpan Span => NullSpan.Instance;
public void Dispose()
{
diff --git a/tracer/src/Datadog.Trace.Manual/Stubs/NullSpan.cs b/tracer/src/Datadog.Trace.Manual/Stubs/NullSpan.cs
index 5afa9489a6fb..02c18f2ddfeb 100644
--- a/tracer/src/Datadog.Trace.Manual/Stubs/NullSpan.cs
+++ b/tracer/src/Datadog.Trace.Manual/Stubs/NullSpan.cs
@@ -9,6 +9,10 @@ internal class NullSpan : ISpan
{
public static readonly NullSpan Instance = new();
+ private NullSpan()
+ {
+ }
+
public string OperationName
{
get => string.Empty;
@@ -43,7 +47,7 @@ public string ServiceName
public ulong SpanId => Context.SpanId;
- public ISpanContext Context { get; } = NullSpanContext.Instance;
+ public ISpanContext Context => NullSpanContext.Instance;
public void Dispose()
{
diff --git a/tracer/src/Datadog.Trace.Manual/Stubs/NullSpanContext.cs b/tracer/src/Datadog.Trace.Manual/Stubs/NullSpanContext.cs
index 9972f596f057..d5100923e30e 100644
--- a/tracer/src/Datadog.Trace.Manual/Stubs/NullSpanContext.cs
+++ b/tracer/src/Datadog.Trace.Manual/Stubs/NullSpanContext.cs
@@ -9,6 +9,10 @@ internal class NullSpanContext : ISpanContext
{
public static readonly NullSpanContext Instance = new();
+ private NullSpanContext()
+ {
+ }
+
public ulong TraceId => 0;
public ulong SpanId => 0;
diff --git a/tracer/src/Datadog.Trace.Manual/Tracer.cs b/tracer/src/Datadog.Trace.Manual/Tracer.cs
index 23cddbd75001..606e9739b6a8 100644
--- a/tracer/src/Datadog.Trace.Manual/Tracer.cs
+++ b/tracer/src/Datadog.Trace.Manual/Tracer.cs
@@ -16,6 +16,7 @@ public sealed class Tracer : ITracer, IDatadogOpenTracingTracer
{
private static Tracer? _instance;
+ [Instrumented]
private Tracer(object? automaticTracer, Dictionary initialValues)
{
AutomaticTracer = automaticTracer;
@@ -115,7 +116,7 @@ private static void Configure(Dictionary settings)
private static object? GetAutomaticTracerInstance() => null;
///
- /// Automatic instrumentation intercepts this method and updates the ManualScope.
+ /// Automatic instrumentation intercepts this method and returns a duck-typed Scope from Datadog.Trace.
///
[Instrumented]
private IScope StartActive(string operationName, ISpanContext? parent, string? serviceName, DateTimeOffset? startTime, bool? finishOnClose)
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkDiscreteStats.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkDiscreteStats.cs
index 5263860370fa..c3e0df6a1c79 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkDiscreteStats.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkDiscreteStats.cs
@@ -5,34 +5,48 @@
#nullable enable
+using Datadog.Trace.DuckTyping;
+
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
///
-/// Reverse duck type for Datadog.Trace.Ci.BenchmarkDiscreteStats in Datadog.Trace.Manual
+/// Duck type for Datadog.Trace.Ci.BenchmarkDiscreteStats in Datadog.Trace.Manual
///
internal interface IBenchmarkDiscreteStats
{
+ [DuckField]
int N { get; }
+ [DuckField]
double Max { get; }
+ [DuckField]
double Min { get; }
+ [DuckField]
double Mean { get; }
+ [DuckField]
double Median { get; }
+ [DuckField]
double StandardDeviation { get; }
+ [DuckField]
double StandardError { get; }
+ [DuckField]
double Kurtosis { get; }
+ [DuckField]
double Skewness { get; }
+ [DuckField]
double P99 { get; }
+ [DuckField]
double P95 { get; }
+ [DuckField]
double P90 { get; }
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkHostInfo.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkHostInfo.cs
index 67fb8bc33d8a..ef3d59538643 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkHostInfo.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkHostInfo.cs
@@ -4,28 +4,39 @@
//
#nullable enable
+using Datadog.Trace.DuckTyping;
+
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
///
-/// Reverse duck type for Datadog.Trace.Ci.BenchmarkHostInfo in Datadog.Trace.Manual
+/// Duck type for Datadog.Trace.Ci.BenchmarkHostInfo in Datadog.Trace.Manual
///
internal interface IBenchmarkHostInfo
{
+ [DuckField]
string? ProcessorName { get; }
+ [DuckField]
int? ProcessorCount { get; }
+ [DuckField]
int? PhysicalCoreCount { get; }
+ [DuckField]
int? LogicalCoreCount { get; }
+ [DuckField]
double? ProcessorMaxFrequencyHertz { get; }
+ [DuckField]
string? OsVersion { get; }
+ [DuckField]
string? RuntimeVersion { get; }
+ [DuckField]
double? ChronometerFrequencyHertz { get; }
+ [DuckField]
double? ChronometerResolution { get; }
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkJobInfo.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkJobInfo.cs
index afdfaa3b5c26..af93bcc1454f 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkJobInfo.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/IBenchmarkJobInfo.cs
@@ -4,6 +4,8 @@
//
#nullable enable
+using Datadog.Trace.DuckTyping;
+
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
///
@@ -11,11 +13,15 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci
///
internal interface IBenchmarkJobInfo
{
+ [DuckField]
string? Description { get; }
+ [DuckField]
string? Platform { get; }
+ [DuckField]
string? RuntimeName { get; }
+ [DuckField]
string? RuntimeMoniker { get; }
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ITestParameters.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ITestParameters.cs
index 5ee946839835..aa889b5389ca 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ITestParameters.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ITestParameters.cs
@@ -11,9 +11,9 @@
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
///
-/// Reverse duck type for Datadog.Trace.Ci.TestParameters in Datadog.Trace.Manual
+/// Duck type for Datadog.Trace.Ci.TestParameters in Datadog.Trace.Manual
///
-internal interface ITestParameters
+internal interface ITestParameters : IDuckType
{
public Dictionary? Metadata { get; }
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTest.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTest.cs
deleted file mode 100644
index 210df47e2c88..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTest.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// 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.Collections.Generic;
-using System.Reflection;
-using Datadog.Trace.Ci;
-using Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-
-internal class ManualTest
-{
- private readonly ManualTestSuite _suite;
-
- public ManualTest(ManualTestSuite suite, Test automatic, Type testType)
- {
- _suite = suite;
- AutomaticTest = automatic;
- Proxy = this.DuckImplement(testType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- public Test AutomaticTest { get; }
-
- [DuckReverseMethod]
- public string? Name => AutomaticTest.Name;
-
- [DuckReverseMethod]
- public DateTimeOffset StartTime => AutomaticTest.StartTime;
-
- [DuckReverseMethod]
- public object Suite => _suite.Proxy;
-
- [DuckReverseMethod]
- public void SetTag(string key, string? value) => AutomaticTest.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetTag(string key, double? value) => AutomaticTest.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetErrorInfo(string type, string message, string? callStack) => AutomaticTest.SetErrorInfo(type, message, callStack);
-
- [DuckReverseMethod]
- public void SetErrorInfo(Exception exception) => AutomaticTest.SetErrorInfo(exception);
-
- [DuckReverseMethod]
- public void SetTestMethodInfo(MethodInfo methodInfo) => AutomaticTest.SetTestMethodInfo(methodInfo);
-
- [DuckReverseMethod]
- public void SetTraits(Dictionary> traits) => AutomaticTest.SetTraits(traits);
-
- [DuckReverseMethod(ParameterTypeNames = ["Datadog.Trace.Ci.TestParameters, Datadog.Trace.Manual"])]
- public void SetParameters(ITestParameters parameters)
- {
- var testParams = new TestParameters { Arguments = parameters.Arguments, Metadata = parameters.Metadata, };
- AutomaticTest.SetParameters(testParams);
- }
-
- // TODO: Figure out how to do these in non-horrible ways
- [DuckReverseMethod(ParameterTypeNames = ["Datadog.Trace.Ci.BenchmarkHostInfo, Datadog.Trace.Manual", "Datadog.Trace.Ci.BenchmarkJobInfo, Datadog.Trace.Manual"])]
- public void SetBenchmarkMetadata(IBenchmarkHostInfo hostInfo, IBenchmarkJobInfo jobInfo)
- => AutomaticTest.SetBenchmarkMetadata(Convert(hostInfo), Convert(jobInfo));
-
- [DuckReverseMethod(ParameterTypeNames = ["Datadog.Trace.Ci.BenchmarkMeasureType, Datadog.Trace.Manual", ClrNames.String, "Datadog.Trace.Ci.BenchmarkDiscreteStats, Datadog.Trace.Manual"])]
- public void AddBenchmarkData(BenchmarkMeasureType measureType, string info, IBenchmarkDiscreteStats statistics)
- => AutomaticTest.AddBenchmarkData(measureType, info, Convert(statistics));
-
- [DuckReverseMethod]
- public void Close(TestStatus status) => AutomaticTest.Close(status);
-
- [DuckReverseMethod]
- public void Close(TestStatus status, TimeSpan? duration) => AutomaticTest.Close(status, duration);
-
- [DuckReverseMethod]
- public void Close(TestStatus status, TimeSpan? duration, string? skipReason)
- => AutomaticTest.Close(status, duration, skipReason);
-
- private static BenchmarkHostInfo Convert(IBenchmarkHostInfo hostInfo) => new()
- {
- ProcessorName = hostInfo.ProcessorName,
- ProcessorCount = hostInfo.ProcessorCount,
- PhysicalCoreCount = hostInfo.PhysicalCoreCount,
- LogicalCoreCount = hostInfo.LogicalCoreCount,
- ProcessorMaxFrequencyHertz = hostInfo.ProcessorMaxFrequencyHertz,
- OsVersion = hostInfo.OsVersion,
- RuntimeVersion = hostInfo.RuntimeVersion,
- ChronometerFrequencyHertz = hostInfo.ChronometerFrequencyHertz,
- ChronometerResolution = hostInfo.ChronometerResolution,
- };
-
- private static BenchmarkJobInfo Convert(IBenchmarkJobInfo jobInfo) => new()
- {
- Description = jobInfo.Description,
- Platform = jobInfo.Platform,
- RuntimeName = jobInfo.RuntimeName,
- RuntimeMoniker = jobInfo.RuntimeMoniker,
- };
-
- private static BenchmarkDiscreteStats Convert(IBenchmarkDiscreteStats stats)
- => new(
- n: stats.N,
- max: stats.Max,
- min: stats.Min,
- mean: stats.Mean,
- median: stats.Median,
- standardDeviation: stats.StandardDeviation,
- standardError: stats.StandardError,
- kurtosis: stats.Kurtosis,
- skewness: stats.Skewness,
- p99: stats.P99,
- p95: stats.P95,
- p90: stats.P90);
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestModule.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestModule.cs
deleted file mode 100644
index 622b76d4eb04..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestModule.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//
-// 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.Threading.Tasks;
-using Datadog.Trace.Ci;
-using Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-
-///
-/// Automatic instrumentation uses reverse duck-typing to create this
-///
-internal class ManualTestModule
-{
- private readonly Type _suiteType;
- private readonly Type _testType;
-
- public ManualTestModule(TestModule automatic, Type moduleType, Type suiteType, Type testType)
- {
- _suiteType = suiteType;
- _testType = testType;
- AutomaticModule = automatic;
- Proxy = this.DuckImplement(moduleType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- public TestModule AutomaticModule { get; }
-
- [DuckReverseMethod]
- public string Name => AutomaticModule.Name;
-
- [DuckReverseMethod]
- public DateTimeOffset StartTime => AutomaticModule.StartTime;
-
- [DuckReverseMethod]
- public string? Framework => AutomaticModule.Framework;
-
- [DuckReverseMethod]
- public void SetTag(string key, string? value) => AutomaticModule.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetTag(string key, double? value) => AutomaticModule.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetErrorInfo(string type, string message, string? callStack) => AutomaticModule.SetErrorInfo(type, message, callStack);
-
- [DuckReverseMethod]
- public void SetErrorInfo(Exception exception) => AutomaticModule.SetErrorInfo(exception);
-
- [DuckReverseMethod]
- public void Close() => AutomaticModule.Close();
-
- [DuckReverseMethod]
- public void Close(TimeSpan? duration) => AutomaticModule.Close(duration);
-
- [DuckReverseMethod]
- public Task CloseAsync() => AutomaticModule.CloseAsync();
-
- [DuckReverseMethod]
- public Task CloseAsync(TimeSpan? duration) => AutomaticModule.CloseAsync(duration);
-
- [DuckReverseMethod]
- public object GetOrCreateSuite(string name)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var suite = AutomaticModule.GetOrCreateSuite(name);
-#pragma warning restore DD0002
- return new ManualTestSuite(this, suite, _suiteType, _testType).Proxy;
- }
-
- [DuckReverseMethod]
- public object GetOrCreateSuite(string name, DateTimeOffset? startDate)
- {
- // Using the public APIs here because we _want_ to record them etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var suite = AutomaticModule.GetOrCreateSuite(name, startDate);
-#pragma warning restore DD0002
- return new ManualTestSuite(this, suite, _suiteType, _testType).Proxy;
- }
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSession.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSession.cs
deleted file mode 100644
index 3c4d22ded967..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSession.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// 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.Threading.Tasks;
-using Datadog.Trace.Ci;
-using Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-
-internal class ManualTestSession
-{
- private readonly Type _moduleType;
- private readonly Type _suiteType;
- private readonly Type _testType;
-
- public ManualTestSession(TestSession automatic, Type sessionType, Type moduleType, Type suiteType, Type testType)
- {
- _moduleType = moduleType;
- _suiteType = suiteType;
- _testType = testType;
- AutomaticSession = automatic;
- Proxy = this.DuckImplement(sessionType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- public TestSession AutomaticSession { get; }
-
- [DuckReverseMethod]
- public string? Command => AutomaticSession.Command;
-
- [DuckReverseMethod]
- public string? WorkingDirectory => AutomaticSession.WorkingDirectory;
-
- [DuckReverseMethod]
- public DateTimeOffset StartTime => AutomaticSession.StartTime;
-
- [DuckReverseMethod]
- public string? Framework => AutomaticSession.Framework;
-
- [DuckReverseMethod]
- public void SetTag(string key, string? value) => AutomaticSession.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetTag(string key, double? value) => AutomaticSession.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetErrorInfo(string type, string message, string? callStack) => AutomaticSession.SetErrorInfo(type, message, callStack);
-
- [DuckReverseMethod]
- public void SetErrorInfo(Exception exception) => AutomaticSession.SetErrorInfo(exception);
-
- [DuckReverseMethod]
- public void Close(TestStatus status) => AutomaticSession.Close(status);
-
- [DuckReverseMethod]
- public void Close(TestStatus status, TimeSpan? duration) => AutomaticSession.Close(status, duration);
-
- [DuckReverseMethod]
- public Task CloseAsync(TestStatus status) => AutomaticSession.CloseAsync(status);
-
- [DuckReverseMethod]
- public Task CloseAsync(TestStatus status, TimeSpan? duration) => AutomaticSession.CloseAsync(status, duration);
-
- [DuckReverseMethod]
- public object CreateModule(string name)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var module = AutomaticSession.CreateModule(name);
-#pragma warning restore DD0002
- return new ManualTestModule(module, _moduleType, _suiteType, _testType).Proxy;
- }
-
- [DuckReverseMethod]
- public object CreateModule(string name, string framework, string frameworkVersion)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var module = AutomaticSession.CreateModule(name, framework, frameworkVersion);
-#pragma warning restore DD0002
- return new ManualTestModule(module, _moduleType, _suiteType, _testType).Proxy;
- }
-
- [DuckReverseMethod]
- public object CreateModule(string name, string framework, string frameworkVersion, DateTimeOffset startDate)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var module = AutomaticSession.CreateModule(name, framework, frameworkVersion, startDate);
-#pragma warning restore DD0002
- return new ManualTestModule(module, _moduleType, _suiteType, _testType).Proxy;
- }
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSuite.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSuite.cs
deleted file mode 100644
index 3e6578c1f969..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/ManualTestSuite.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-//
-// 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 Datadog.Trace.Ci;
-using Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-
-internal class ManualTestSuite
-{
- private readonly ManualTestModule _module;
- private readonly Type _testType;
-
- public ManualTestSuite(ManualTestModule module, TestSuite automatic, Type suiteType, Type testType)
- {
- _module = module;
- _testType = testType;
- AutomaticSuite = automatic;
- Proxy = this.DuckImplement(suiteType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- public TestSuite AutomaticSuite { get; }
-
- [DuckReverseMethod]
- public string Name => AutomaticSuite.Name;
-
- [DuckReverseMethod]
- public DateTimeOffset StartTime => AutomaticSuite.StartTime;
-
- [DuckReverseMethod]
- public object Module => _module.Proxy;
-
- [DuckReverseMethod]
- public void SetTag(string key, string? value) => AutomaticSuite.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetTag(string key, double? value) => AutomaticSuite.SetTag(key, value);
-
- [DuckReverseMethod]
- public void SetErrorInfo(string type, string message, string? callStack) => AutomaticSuite.SetErrorInfo(type, message, callStack);
-
- [DuckReverseMethod]
- public void SetErrorInfo(Exception exception) => AutomaticSuite.SetErrorInfo(exception);
-
- [DuckReverseMethod]
- public void Close() => AutomaticSuite.Close();
-
- [DuckReverseMethod]
- public void Close(TimeSpan? duration) => AutomaticSuite.Close(duration);
-
- [DuckReverseMethod]
- public object CreateTest(string name)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var test = AutomaticSuite.CreateTest(name);
-#pragma warning restore DD0002
- return new ManualTest(this, test, _testType).Proxy;
- }
-
- [DuckReverseMethod]
- public object CreateTest(string name, DateTimeOffset startDate)
- {
- // Using the public APIs here because we _want_ to record them in the telemetry etc
-#pragma warning disable DD0002 // This API is only for public usage and should not be called internally
- var test = AutomaticSuite.CreateTest(name, startDate);
-#pragma warning restore DD0002
- return new ManualTest(this, test, _testType).Proxy;
- }
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/TestObjectsHelper.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/TestObjectsHelper.cs
deleted file mode 100644
index c3b24d1ef409..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/Proxies/TestObjectsHelper.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// 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 Datadog.Trace.Ci;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-
-internal static class TestObjectsHelper
-{
- private static readonly Type ITestSessionType;
- private static readonly Type ITestModuleType;
- private static readonly Type ITestSuiteType;
- private static readonly Type ITestType;
-
- static TestObjectsHelper()
- {
- var assembly = typeof(TMarkerType).Assembly;
- ITestSessionType = assembly.GetType("Datadog.Trace.Ci.ITestSession")!;
- ITestModuleType = assembly.GetType("Datadog.Trace.Ci.ITestModule")!;
- ITestSuiteType = assembly.GetType("Datadog.Trace.Ci.ITestSuite")!;
- ITestType = assembly.GetType("Datadog.Trace.Ci.ITest")!;
- }
-
- public static object CreateTestModule(TestModule testModule)
- => new ManualTestModule(testModule, ITestModuleType, ITestSuiteType, ITestType).Proxy;
-
- public static object CreateTestSession(TestSession testSession)
- => new ManualTestSession(testSession, ITestSessionType, ITestModuleType, ITestSuiteType, ITestType).Proxy;
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsAddBenchmarkDataIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsAddBenchmarkDataIntegration.cs
new file mode 100644
index 000000000000..451fc8f319a7
--- /dev/null
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsAddBenchmarkDataIntegration.cs
@@ -0,0 +1,60 @@
+//
+// 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.ComponentModel;
+using Datadog.Trace.Ci;
+using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
+using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
+using Datadog.Trace.Vendors.StatsdClient.Statistic;
+
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci;
+
+///
+/// Datadog.Trace.Ci.TestExtensions::AddBenchmarkData() calltarget instrumentation
+///
+[InstrumentMethod(
+ AssemblyName = "Datadog.Trace.Manual",
+ TypeName = "Datadog.Trace.Ci.TestExtensions",
+ MethodName = "AddBenchmarkData",
+ ReturnTypeName = ClrNames.Void,
+ ParameterTypeNames = ["Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkMeasureType", ClrNames.String, "Datadog.Trace.Ci.BenchmarkDiscreteStats&"],
+ MinimumVersion = ManualInstrumentationConstants.MinVersion,
+ MaximumVersion = ManualInstrumentationConstants.MaxVersion,
+ IntegrationName = ManualInstrumentationConstants.IntegrationName)]
+[Browsable(false)]
+[EditorBrowsable(EditorBrowsableState.Never)]
+public class TestExtensionsAddBenchmarkDataIntegration
+{
+ internal static CallTargetState OnMethodBegin(TTest test, BenchmarkMeasureType measureType, string info, in TStats statistics)
+ where TStats : IBenchmarkDiscreteStats
+ {
+ // Test is an ITest, so it could be something arbitrary - if so, we just ignore it.
+ // This is not ideal, but these methods can be directly duck typed using the same "shape" as Test,
+ // so it's the lesser of two evils.
+
+ if (test is IDuckType { Instance: Test automaticTest })
+ {
+ var stats = new BenchmarkDiscreteStats(
+ n: statistics.N,
+ max: statistics.Max,
+ min: statistics.Min,
+ mean: statistics.Mean,
+ median: statistics.Median,
+ standardDeviation: statistics.StandardDeviation,
+ standardError: statistics.StandardError,
+ kurtosis: statistics.Kurtosis,
+ skewness: statistics.Skewness,
+ p99: statistics.P99,
+ p95: statistics.P95,
+ p90: statistics.P90);
+
+ automaticTest.AddBenchmarkData(measureType, info, in stats);
+ }
+
+ return CallTargetState.GetDefault();
+ }
+}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetBenchmarkMetadataIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetBenchmarkMetadataIntegration.cs
new file mode 100644
index 000000000000..841e87d51490
--- /dev/null
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetBenchmarkMetadataIntegration.cs
@@ -0,0 +1,68 @@
+//
+// 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.ComponentModel;
+using Datadog.Trace.Ci;
+using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
+using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
+
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci;
+
+///
+/// Datadog.Trace.Ci.TestExtensions::SetBenchmarkMetadata() calltarget instrumentation
+///
+[InstrumentMethod(
+ AssemblyName = "Datadog.Trace.Manual",
+ TypeName = "Datadog.Trace.Ci.TestExtensions",
+ MethodName = "SetBenchmarkMetadata",
+ ReturnTypeName = ClrNames.Void,
+ ParameterTypeNames = ["Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkHostInfo&", "Datadog.Trace.Ci.BenchmarkJobInfo&"],
+ MinimumVersion = ManualInstrumentationConstants.MinVersion,
+ MaximumVersion = ManualInstrumentationConstants.MaxVersion,
+ IntegrationName = ManualInstrumentationConstants.IntegrationName)]
+[Browsable(false)]
+[EditorBrowsable(EditorBrowsableState.Never)]
+public class TestExtensionsSetBenchmarkMetadataIntegration
+{
+ internal static CallTargetState OnMethodBegin(TTest test, in THostInfo hostInfo, in TJobInfo jobInfo)
+ where THostInfo : IBenchmarkHostInfo
+ where TJobInfo : IBenchmarkJobInfo
+ {
+ // Test is an ITest, so it could be something arbitrary - if so, we just ignore it.
+ // This is not ideal, but these methods can be directly duck typed using the same "shape" as Test,
+ // so it's the lesser of two evils.
+
+ if (test is IDuckType { Instance: Test automaticTest })
+ {
+ var host = new BenchmarkHostInfo
+ {
+ ProcessorName = hostInfo.ProcessorName,
+ ProcessorCount = hostInfo.ProcessorCount,
+ PhysicalCoreCount = hostInfo.PhysicalCoreCount,
+ LogicalCoreCount = hostInfo.LogicalCoreCount,
+ ProcessorMaxFrequencyHertz = hostInfo.ProcessorMaxFrequencyHertz,
+ OsVersion = hostInfo.OsVersion,
+ RuntimeVersion = hostInfo.RuntimeVersion,
+ ChronometerFrequencyHertz = hostInfo.ChronometerFrequencyHertz,
+ ChronometerResolution = hostInfo.ChronometerResolution,
+ };
+
+ var job = new BenchmarkJobInfo()
+ {
+ Description = jobInfo.Description,
+ Platform = jobInfo.Platform,
+ RuntimeName = jobInfo.RuntimeName,
+ RuntimeMoniker = jobInfo.RuntimeMoniker,
+ };
+
+ automaticTest.SetBenchmarkMetadata(in host, in job);
+ }
+
+ return CallTargetState.GetDefault();
+ }
+}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetParametersIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetParametersIntegration.cs
new file mode 100644
index 000000000000..1f0a8e7cc5ca
--- /dev/null
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestExtensionsSetParametersIntegration.cs
@@ -0,0 +1,46 @@
+//
+// 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.Ci;
+using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
+using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
+
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci;
+
+///
+/// Datadog.Trace.Ci.TestExtensions::SetParameters() calltarget instrumentation
+///
+[InstrumentMethod(
+ AssemblyName = "Datadog.Trace.Manual",
+ TypeName = "Datadog.Trace.Ci.TestExtensions",
+ MethodName = "SetParameters",
+ ReturnTypeName = ClrNames.Void,
+ ParameterTypeNames = ["Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.TestParameters"],
+ MinimumVersion = ManualInstrumentationConstants.MinVersion,
+ MaximumVersion = ManualInstrumentationConstants.MaxVersion,
+ IntegrationName = ManualInstrumentationConstants.IntegrationName)]
+[Browsable(false)]
+[EditorBrowsable(EditorBrowsableState.Never)]
+public class TestExtensionsSetParametersIntegration
+{
+ internal static CallTargetState OnMethodBegin(TTest test, in TParameters parameters)
+ where TParameters : ITestParameters
+ {
+ // Test is an ITest, so it could be something arbitrary - if so, we just ignore it.
+ // This is not ideal, but these methods can be directly duck typed using the same "shape" as Test,
+ // so it's the lesser of two evils.
+
+ if (test is IDuckType { Instance: Test automaticTest } && parameters.Instance is not null)
+ {
+ automaticTest.SetParameters(new TestParameters { Arguments = parameters.Arguments, Metadata = parameters.Metadata });
+ }
+
+ return CallTargetState.GetDefault();
+ }
+}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestModuleInternalCreateIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestModuleInternalCreateIntegration.cs
index 90426d3b765d..4edf8fa05184 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestModuleInternalCreateIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestModuleInternalCreateIntegration.cs
@@ -9,6 +9,7 @@
using Datadog.Trace.Ci;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;
@@ -39,8 +40,7 @@ internal static CallTargetState OnMethodBegin(string name, string frame
internal static CallTargetReturn OnMethodEnd(TReturn returnValue, Exception exception, in CallTargetState state)
{
- // reverse ducktype the TestModule as an ITestModule
- var proxy = (TReturn)TestObjectsHelper.CreateTestModule((TestModule)state.State);
- return new CallTargetReturn(proxy);
+ // Duck cast TestModule as an ITestModule
+ return new CallTargetReturn(state.State.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestSessionInternalGetOrCreateIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestSessionInternalGetOrCreateIntegration.cs
index 425134667db3..da6e4fcd44ba 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestSessionInternalGetOrCreateIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Ci/TestSessionInternalGetOrCreateIntegration.cs
@@ -9,6 +9,7 @@
using Datadog.Trace.Ci;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;
@@ -48,8 +49,7 @@ internal static CallTargetState OnMethodBegin(string command, string wo
/// A return value, in an async scenario will be T of Task of T
internal static CallTargetReturn OnMethodEnd(TReturn returnValue, Exception exception, in CallTargetState state)
{
- // reverse ducktype the TestSession as an ITestSession
- var proxy = (TReturn)TestObjectsHelper.CreateTestSession((TestSession)state.State);
- return new CallTargetReturn(proxy);
+ // Duck cast TestSession as an ITestSession
+ return new CallTargetReturn(state.State.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/ImmutableTracerSettings/AgentUriIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/ImmutableTracerSettings/AgentUriIntegration.cs
new file mode 100644
index 000000000000..2e217f7d2408
--- /dev/null
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/ImmutableTracerSettings/AgentUriIntegration.cs
@@ -0,0 +1,37 @@
+//
+// 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.ComponentModel;
+using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.Telemetry;
+using Datadog.Trace.Telemetry.Metrics;
+
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings;
+
+///
+/// System.Uri Datadog.Trace.Configuration.ImmutableTracerSettings::get_AgentUri() calltarget instrumentation
+///
+[InstrumentMethod(
+ AssemblyName = "Datadog.Trace.Manual",
+ TypeName = "Datadog.Trace.Configuration.ImmutableTracerSettings",
+ MethodName = "get_AgentUri",
+ ReturnTypeName = "System.Uri",
+ ParameterTypeNames = [],
+ MinimumVersion = ManualInstrumentationConstants.MinVersion,
+ MaximumVersion = ManualInstrumentationConstants.MaxVersion,
+ IntegrationName = ManualInstrumentationConstants.IntegrationName)]
+[Browsable(false)]
+[EditorBrowsable(EditorBrowsableState.Never)]
+public class AgentUriIntegration
+{
+ internal static CallTargetState OnMethodBegin(TTarget instance)
+ {
+ // Ok, this public API is a _bit_ weird now, because it's not what we're actually
+ // instrumenting, but for now this is the easiest, and avoids "duplicate" telemetry
+ TelemetryFactory.Metrics.Record(PublicApiUsage.ImmutableExporterSettings_AgentUri_Get);
+ return CallTargetState.GetDefault();
+ }
+}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/AgentUriGetIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/AgentUriGetIntegration.cs
index e6a5a81e6e50..dc8e74e11c1b 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/AgentUriGetIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/AgentUriGetIntegration.cs
@@ -30,6 +30,8 @@ public class AgentUriGetIntegration
{
internal static CallTargetState OnMethodBegin(TTarget instance)
{
+ // Ok, this public API is a _bit_ weird now, because it's not what we're actually
+ // instrumenting, but for now this is the easiest, and avoids "duplicate" telemetry
TelemetryFactory.Metrics.Record(PublicApiUsage.ExporterSettings_AgentUri_Get);
return CallTargetState.GetDefault();
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettingsPopulateDictionaryIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/PopulateDictionaryIntegration.cs
similarity index 90%
rename from tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettingsPopulateDictionaryIntegration.cs
rename to tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/PopulateDictionaryIntegration.cs
index 4fdabae387a9..6a587006e94e 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettingsPopulateDictionaryIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Configuration/TracerSettings/PopulateDictionaryIntegration.cs
@@ -1,20 +1,17 @@
-//
+//
// 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.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using Datadog.Trace.ClrProfiler.CallTarget;
using Datadog.Trace.Configuration;
using Datadog.Trace.Configuration.Telemetry;
-using Datadog.Trace.Telemetry;
-using Datadog.Trace.Telemetry.Metrics;
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration;
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings;
///
/// System.Boolean Datadog.Trace.Configuration.TracerSettings::PopulateDictionary() calltarget instrumentation
@@ -30,7 +27,7 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Co
IntegrationName = ManualInstrumentationConstants.IntegrationName)]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
-public class TracerSettingsPopulateDictionaryIntegration
+public class PopulateDictionaryIntegration
{
internal static CallTargetState OnMethodBegin(Dictionary values, bool useDefaultSources)
{
@@ -60,7 +57,7 @@ internal static void PopulateSettings(Dictionary values, Trace.
values[TracerSettingKeyConstants.HeaderTags] = settings.HeaderTagsInternal;
values[TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey] = settings.KafkaCreateConsumerScopeEnabledInternal;
#pragma warning disable DD0002 // This API is only for public usage and should not be called internally (there's no internal version currently)
- values[TracerSettingKeyConstants.LogsInjectionEnabledKey] = settings.LogSubmissionSettings.LogsInjectionEnabled ?? false;
+ values[TracerSettingKeyConstants.LogsInjectionEnabledKey] = settings.LogSubmissionSettings.LogsInjectionEnabled;
#pragma warning restore DD0002
values[TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey] = settings.MaxTracesSubmittedPerSecondInternal;
values[TracerSettingKeyConstants.ServiceNameKey] = settings.ServiceNameInternal;
@@ -84,7 +81,7 @@ internal static void PopulateSettings(Dictionary values, Trace.
var results = new Dictionary(settings.Settings.Length, StringComparer.OrdinalIgnoreCase);
foreach (var setting in settings.Settings)
{
- results[setting.IntegrationNameInternal] = [setting.EnabledInternal, setting.AnalyticsEnabledInternal, setting.AnalyticsSampleRateInternal];
+ results[setting.IntegrationNameInternal] = IntegrationSettingsSerializationHelper.SerializeFromAutomatic(setting.EnabledInternal, setting.AnalyticsEnabledInternal, setting.AnalyticsSampleRateInternal);
}
return results;
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTagIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTagIntegration.cs
index 8c9c49e07ea9..85f50767edd4 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTagIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTagIntegration.cs
@@ -35,16 +35,20 @@ internal static CallTargetState OnMethodBegin(ref TSpan span, re
TelemetryFactory.Metrics.Record(PublicApiUsage.SpanExtensions_SetTag);
// Annoyingly, this takes an ISpan, so we have to do some duckTyping to make it work
- if (span is IDuckType { Instance: ManualSpan { AutomaticSpan: { } duckTyped } })
+ // it's most likely to be a duck-typed Span, so try that first
+ if (span is IDuckType { Instance: Span s })
{
// this is the "typical" scenario
- duckTyped.SetTagInternal(key, value);
+ s.SetTagInternal(key, value);
}
else if (span is Span autoSpan)
{
- // Not likely, but technically possible for this to happen
autoSpan.SetTagInternal(key, value);
}
+ else if (span is null)
+ {
+ // bad usage, but catering to it just in case
+ }
else
{
// This is a worst case, should basically never be necessary
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTraceSamplingPriorityIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTraceSamplingPriorityIntegration.cs
index b80b4c41fc3d..66dd34562b30 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTraceSamplingPriorityIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetTraceSamplingPriorityIntegration.cs
@@ -35,22 +35,19 @@ internal static CallTargetState OnMethodBegin(ref TSpan span, Sa
{
TelemetryFactory.Metrics.Record(PublicApiUsage.SpanExtensions_SetTraceSamplingPriority);
- if (span is IDuckType { Instance: ManualSpan { AutomaticSpan: { } duckTyped } })
+ // Annoyingly, this takes an ISpan, so we have to do some duckTyping to make it work
+ // it's most likely to be a duck-typed Span, so try that first
+ if (span is IDuckType { Instance: Span s })
{
- // this is the "typical" scenario
- duckTyped.SetTraceSamplingPriorityInternal(samplingPriority);
+ s.SetTraceSamplingPriorityInternal(samplingPriority);
}
else if (span is Span autoSpan)
{
- // Not likely, but technically possible for this to happen
autoSpan.SetTraceSamplingPriorityInternal(samplingPriority);
}
- else
- {
- // If this isn't an automatic span, then this almost certainly won't work,
- // because SetTraceSamplingPriorityInternal tries to extract the "real" SpanContext from it
- }
+ // If this isn't an automatic span, or the span is null, then this almost certainly won't work,
+ // because SetTraceSamplingPriorityInternal tries to extract the "real" SpanContext from it
return CallTargetState.GetDefault();
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetUserIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetUserIntegration.cs
index 8a6c614cd7c0..ec7a31058aa3 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetUserIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Extensions/SpanExtensionsSetUserIntegration.cs
@@ -33,10 +33,10 @@ internal static CallTargetState OnMethodBegin(ref TSpan span, st
// Annoyingly, this takes an ISpan, so we have to do some duckTyping to make it work
ISpan? realSpan = null;
- if (span is IDuckType { Instance: ManualSpan { AutomaticSpan: { } duckTyped } })
+ // it's most likely to be a duck-typed Span, so try that first
+ if (span is IDuckType { Instance: Span s })
{
- // this is the "typical" scenario
- realSpan = duckTyped;
+ realSpan = s;
}
else if (span is Span autoSpan)
{
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/IntegrationSettingsSerializationHelper.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/IntegrationSettingsSerializationHelper.cs
new file mode 100644
index 000000000000..50fdc615ab6a
--- /dev/null
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/IntegrationSettingsSerializationHelper.cs
@@ -0,0 +1,109 @@
+//
+// 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.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation;
+
+internal static class IntegrationSettingsSerializationHelper
+{
+ public static object?[] SerializeFromAutomatic(
+ bool? enabled,
+ bool? analyticsEnabled,
+ double analyticsSampleRate)
+ => [enabled, analyticsEnabled, analyticsSampleRate];
+
+ public static bool TryDeserializeFromAutomatic(
+ object?[] values,
+ out bool? enabled,
+ out bool? analyticsEnabled,
+ out double analyticsSampleRate)
+ {
+ if (values is null || values.Length < 3)
+ {
+ // this will never happen unless there's a bad version mismatch issue, so just bail out
+ enabled = null;
+ analyticsEnabled = null;
+ analyticsSampleRate = 1.0;
+ return false;
+ }
+
+ enabled = values[0] as bool?;
+ analyticsEnabled = values[1] as bool?;
+ analyticsSampleRate = values[2] as double? ?? 1.0;
+ return true;
+ }
+
+ public static object?[]? SerializeFromManual(
+ bool enabledChanged,
+ bool? enabled,
+ bool analyticsEnabledChanged,
+ bool? analyticsEnabled,
+ bool analyticsSampleRateChanged,
+ double? analyticsSampleRate)
+ {
+ if (enabledChanged || analyticsEnabledChanged || analyticsSampleRateChanged)
+ {
+ // we have changes, record everything
+ // Yes, this is a lot of boxing :(
+ return
+ [
+ enabledChanged,
+ enabled,
+ analyticsEnabledChanged,
+ analyticsEnabled,
+ analyticsSampleRateChanged,
+ analyticsSampleRate,
+ ];
+ }
+
+ // no changes
+ return null;
+ }
+
+ public static bool TryDeserializeFromManual(
+ object?[] values,
+ out bool enabledChanged,
+ out bool? enabled,
+ out bool analyticsEnabledChanged,
+ out bool? analyticsEnabled,
+ out bool analyticsSampleRateChanged,
+ out double analyticsSampleRate)
+ {
+ if (values is not { Length: 6 })
+ {
+ // bad version mismatch issue, so just bail out
+ enabledChanged = false;
+ enabled = null;
+ analyticsEnabledChanged = false;
+ analyticsEnabled = null;
+ analyticsSampleRateChanged = false;
+ analyticsSampleRate = 1.0;
+ return false;
+ }
+
+ enabledChanged = values[0] is true;
+ enabled = values[1] as bool?;
+
+ analyticsEnabledChanged = values[2] is true;
+ analyticsEnabled = values[3] as bool?;
+
+ if (values[4] is true && values[5] is double rate)
+ {
+ analyticsSampleRateChanged = true;
+ analyticsSampleRate = rate;
+ }
+ else
+ {
+ analyticsSampleRateChanged = false;
+ analyticsSampleRate = 1.0;
+ }
+
+ return true;
+ }
+}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorConstructorIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorConstructorIntegration.cs
index 507054e26977..58358fbf5665 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorConstructorIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorConstructorIntegration.cs
@@ -21,7 +21,7 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Pr
TypeName = "Datadog.Trace.SpanContextExtractor",
MethodName = ".ctor",
ReturnTypeName = ClrNames.Void,
- ParameterTypeNames = new string[0],
+ ParameterTypeNames = [],
MinimumVersion = ManualInstrumentationConstants.MinVersion,
MaximumVersion = ManualInstrumentationConstants.MaxVersion,
IntegrationName = ManualInstrumentationConstants.IntegrationName)]
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorExtractIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorExtractIntegration.cs
index 55c3094c47f0..ce19cbf17e13 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorExtractIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextExtractorExtractIntegration.cs
@@ -9,6 +9,7 @@
using System.ComponentModel;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
using Datadog.Trace.Telemetry;
using Datadog.Trace.Telemetry.Metrics;
@@ -22,7 +23,7 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Pr
TypeName = "Datadog.Trace.SpanContextExtractor",
MethodName = "Extract",
ReturnTypeName = "Datadog.Trace.ISpanContext",
- ParameterTypeNames = new[] { "!!0", "System.Func`3[!!0,System.String,System.Collections.Generic.IEnumerable`1[System.String]]" },
+ ParameterTypeNames = ["!!0", "System.Func`3[!!0,System.String,System.Collections.Generic.IEnumerable`1[System.String]]"],
MinimumVersion = ManualInstrumentationConstants.MinVersion,
MaximumVersion = ManualInstrumentationConstants.MaxVersion,
IntegrationName = ManualInstrumentationConstants.IntegrationName)]
@@ -40,9 +41,6 @@ internal static CallTargetState OnMethodBegin(TTarge
internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn returnValue, Exception exception, in CallTargetState state)
{
- var updatedReturn = state.State is ISpanContext spanContext
- ? (TReturn)ScopeHelper.CreateManualSpanContext(spanContext).Proxy
- : returnValue; // This is always null, so lets us satisfy the types easily
- return new CallTargetReturn(updatedReturn);
+ return new CallTargetReturn(state.State.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextInjectorInjectIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextInjectorInjectIntegration.cs
index 5a374094621e..546c84297c45 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextInjectorInjectIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Propagators/SpanContextInjectorInjectIntegration.cs
@@ -34,6 +34,7 @@ internal static CallTargetState OnMethodBegin)(object)setter!;
+
if (SpanContextHelper.GetContext(context) is { } spanContext)
{
SpanContextInjector.InjectInternal(carrier, inject, spanContext);
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualScope.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualScope.cs
deleted file mode 100644
index acac01d9fd3c..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualScope.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// 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 Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
-
-///
-/// Used to reverse duck-type an IScope in custom instrumentation
-///
-internal class ManualScope
-{
- private readonly ManualSpan _manualSpan;
-
- internal ManualScope(IScope scope, ManualSpan manualSpan, Type scopeType)
- {
- _manualSpan = manualSpan;
- AutomaticScope = scope;
- Proxy = this.DuckImplement(scopeType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- internal IScope AutomaticScope { get; }
-
- [DuckReverseMethod(ParameterTypeNames = new[] { "Datadog.Trace.IScope, Datadog.Trace.Manual" })]
- public object Span => _manualSpan.Proxy;
-
- [DuckReverseMethod]
- public void Dispose() => AutomaticScope.Dispose();
-
- [DuckReverseMethod]
- public void Close() => AutomaticScope.Close();
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpan.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpan.cs
deleted file mode 100644
index c1cbf5a3bf73..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpan.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// 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 Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
-
-///
-/// Used to reverse duck-type an ISpan in custom instrumentation
-///
-internal class ManualSpan
-{
- private readonly ManualSpanContext _spanContext;
-
- public ManualSpan(ISpan span, ManualSpanContext spanContext, Type spanType)
- {
- _spanContext = spanContext;
- AutomaticSpan = span;
- Proxy = this.DuckImplement(spanType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- public ISpan AutomaticSpan { get; }
-
- [DuckReverseMethod]
- public string OperationName
- {
- get => AutomaticSpan.OperationName;
- set => AutomaticSpan.OperationName = value;
- }
-
- [DuckReverseMethod]
- public string ResourceName
- {
- get => AutomaticSpan.ResourceName;
- set => AutomaticSpan.ResourceName = value;
- }
-
- [DuckReverseMethod]
- public string Type
- {
- get => AutomaticSpan.Type;
- set => AutomaticSpan.Type = value;
- }
-
- [DuckReverseMethod]
- public bool Error
- {
- get => AutomaticSpan.Error;
- set => AutomaticSpan.Error = value;
- }
-
- [DuckReverseMethod]
- public string ServiceName
- {
- get => AutomaticSpan.ServiceName;
- set => AutomaticSpan.ServiceName = value;
- }
-
- [DuckReverseMethod]
- public ulong TraceId => AutomaticSpan.TraceId;
-
- [DuckReverseMethod]
- public ulong SpanId => AutomaticSpan.SpanId;
-
- [DuckReverseMethod(ParameterTypeNames = new[] { "Datadog.Trace.ISpanContext, Datadog.Trace.Manual" })]
- public object Context => _spanContext.Proxy;
-
- [DuckReverseMethod]
- public void Dispose() => AutomaticSpan.Dispose();
-
- [DuckReverseMethod]
- public object SetTag(string key, string? value)
- {
- AutomaticSpan.SetTag(key, value);
- return Proxy;
- }
-
- [DuckReverseMethod]
- public void Finish() => AutomaticSpan.Finish();
-
- [DuckReverseMethod]
- public void Finish(DateTimeOffset finishTimestamp) => AutomaticSpan.Finish(finishTimestamp);
-
- [DuckReverseMethod]
- public void SetException(Exception exception) => AutomaticSpan.SetException(exception);
-
- [DuckReverseMethod]
- public string? GetTag(string key) => AutomaticSpan.GetTag(key);
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpanContext.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpanContext.cs
deleted file mode 100644
index 66e3f5bc735f..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ManualSpanContext.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// 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 Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
-
-///
-/// Used to reverse duck-type an ISpanContext in custom instrumentation
-///
-internal class ManualSpanContext : ISpanContext
-{
- public ManualSpanContext(ISpanContext context, Type spanContextType)
- {
- AutomaticContext = context;
- Proxy = this.DuckImplement(spanContextType);
- }
-
- ///
- /// Gets the reverse-duck-type of this object for manual instrumentation
- ///
- internal object Proxy { get; }
-
- internal ISpanContext AutomaticContext { get; }
-
- [DuckReverseMethod]
- public ulong TraceId => AutomaticContext.TraceId;
-
- [DuckReverseMethod]
- public ulong SpanId => AutomaticContext.SpanId;
-
- [DuckReverseMethod]
- public string? ServiceName => AutomaticContext.ServiceName;
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ScopeHelper.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ScopeHelper.cs
deleted file mode 100644
index 81070015b3ca..000000000000
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Proxies/ScopeHelper.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// 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 Datadog.Trace.DuckTyping;
-
-namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
-
-internal static class ScopeHelper
-{
- private static readonly Type IScopeType;
- private static readonly Type ISpanType;
- private static readonly Type ISpanContextType;
-
- static ScopeHelper()
- {
- var assembly = typeof(TMarkerType).Assembly;
- IScopeType = assembly.GetType("Datadog.Trace.IScope")!;
- ISpanType = assembly.GetType("Datadog.Trace.ISpan")!;
- ISpanContextType = assembly.GetType("Datadog.Trace.ISpanContext")!;
- }
-
- public static ManualScope CreateManualScope(IScope scope)
- => new(scope, CreateManualSpan(scope.Span), IScopeType);
-
- public static ManualSpan CreateManualSpan(ISpan span)
- => new(span, CreateManualSpanContext(span.Context), ISpanType);
-
- public static ManualSpanContext CreateManualSpanContext(ISpanContext context)
- => new(context, ISpanContextType);
-}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/SpanContextHelper.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/SpanContextHelper.cs
index 78c8869aab33..b36ae0260cba 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/SpanContextHelper.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/SpanContextHelper.cs
@@ -13,14 +13,14 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation;
internal static class SpanContextHelper
{
- [return:NotNullIfNotNull(nameof(context))]
+ [return: NotNullIfNotNull(nameof(context))]
public static ISpanContext? GetContext(T context)
=> context switch
{
null => null,
SpanContext c => c,
- ManualSpanContext { AutomaticContext: { } automaticContext } => automaticContext,
ISpanContext c => c,
+ IDuckType { Instance: SpanContext c } => c,
_ when context.TryDuckCast(out var spanContextProxy) => new SpanContext(
new TraceId(Upper: spanContextProxy.TraceIdUpper, Lower: spanContextProxy.TraceId),
spanContextProxy.SpanId,
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/ConfigureIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/ConfigureIntegration.cs
index 20759c2fcee1..3f84b63f5fcc 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/ConfigureIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/ConfigureIntegration.cs
@@ -56,179 +56,177 @@ internal static CallTargetState OnMethodBegin(Dictionary dictionary, TracerSettings tracerSettings)
{
+ foreach (var setting in dictionary)
{
- foreach (var setting in dictionary)
+ switch (setting.Key)
{
- switch (setting.Key)
- {
- case TracerSettingKeyConstants.AgentUriKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.ExporterSettings_AgentUri_Set);
- tracerSettings.ExporterInternal.AgentUriInternal = (setting.Value as Uri)!;
- break;
+ case TracerSettingKeyConstants.AgentUriKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.ExporterSettings_AgentUri_Set);
+ tracerSettings.ExporterInternal.AgentUriInternal = (setting.Value as Uri)!;
+ break;
- case TracerSettingKeyConstants.AnalyticsEnabledKey:
+ case TracerSettingKeyConstants.AnalyticsEnabledKey:
#pragma warning disable CS0618 // Type or member is obsolete
- TelemetryFactory.Metrics.Record(PublicApiUsage.IntegrationSettings_AnalyticsEnabled_Set);
- tracerSettings.AnalyticsEnabledInternal = (bool)setting.Value!;
+ TelemetryFactory.Metrics.Record(PublicApiUsage.IntegrationSettings_AnalyticsEnabled_Set);
+ tracerSettings.AnalyticsEnabledInternal = (bool)setting.Value!;
#pragma warning restore CS0618 // Type or member is obsolete
- break;
-
- case TracerSettingKeyConstants.CustomSamplingRules:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_CustomSamplingRules_Get);
- tracerSettings.CustomSamplingRulesInternal = setting.Value as string;
- break;
-
- case TracerSettingKeyConstants.DiagnosticSourceEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_DiagnosticSourceEnabled_Set);
- // there is no setter, it doesn't do anything
- break;
-
- case TracerSettingKeyConstants.DisabledIntegrationNamesKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_DisabledIntegrationNames_Set);
- tracerSettings.DisabledIntegrationNamesInternal = setting.Value as HashSet ?? [];
- break;
-
- case TracerSettingKeyConstants.EnvironmentKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_Environment_Set);
- tracerSettings.EnvironmentInternal = setting.Value as string;
- break;
-
- case TracerSettingKeyConstants.GlobalSamplingRateKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GlobalSamplingRate_Set);
- tracerSettings.GlobalSamplingRateInternal = setting.Value as double?;
- break;
-
- case TracerSettingKeyConstants.GrpcTags:
- if (setting.Value is IDictionary { } grpcTags)
+ break;
+
+ case TracerSettingKeyConstants.CustomSamplingRules:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_CustomSamplingRules_Get);
+ tracerSettings.CustomSamplingRulesInternal = setting.Value as string;
+ break;
+
+ case TracerSettingKeyConstants.DiagnosticSourceEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_DiagnosticSourceEnabled_Set);
+ // there is no setter, it doesn't do anything
+ break;
+
+ case TracerSettingKeyConstants.DisabledIntegrationNamesKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_DisabledIntegrationNames_Set);
+ tracerSettings.DisabledIntegrationNamesInternal = setting.Value as HashSet ?? [];
+ break;
+
+ case TracerSettingKeyConstants.EnvironmentKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_Environment_Set);
+ tracerSettings.EnvironmentInternal = setting.Value as string;
+ break;
+
+ case TracerSettingKeyConstants.GlobalSamplingRateKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GlobalSamplingRate_Set);
+ tracerSettings.GlobalSamplingRateInternal = setting.Value as double?;
+ break;
+
+ case TracerSettingKeyConstants.GrpcTags:
+ if (setting.Value is IDictionary { } grpcTags)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GrpcTags_Set);
+ var currentTags = tracerSettings.GrpcTagsInternal;
+ // This is a replacement, so make sure to clear
+ // Could also use a setter
+ currentTags.Clear();
+ foreach (var tag in grpcTags)
{
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GrpcTags_Set);
- var currentTags = tracerSettings.GrpcTagsInternal;
- // This is a replacement, so make sure to clear
- // Could also use a setter
- currentTags.Clear();
- foreach (var tag in grpcTags)
- {
- currentTags[tag.Key] = tag.Value;
- }
+ currentTags[tag.Key] = tag.Value;
}
+ }
- break;
+ break;
- case TracerSettingKeyConstants.HeaderTags:
- if (setting.Value is IDictionary { } headerTags)
+ case TracerSettingKeyConstants.HeaderTags:
+ if (setting.Value is IDictionary { } headerTags)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_HeaderTags_Set);
+ var currentTags = tracerSettings.HeaderTagsInternal;
+ // This is a replacement, so make sure to clear
+ // Could also use a setter
+ currentTags.Clear();
+ foreach (var tag in headerTags)
{
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_HeaderTags_Set);
- var currentTags = tracerSettings.HeaderTagsInternal;
- // This is a replacement, so make sure to clear
- // Could also use a setter
- currentTags.Clear();
- foreach (var tag in headerTags)
- {
- currentTags[tag.Key] = tag.Value;
- }
+ currentTags[tag.Key] = tag.Value;
}
+ }
- break;
+ break;
- case TracerSettingKeyConstants.GlobalTagsKey:
- if (setting.Value is IDictionary { } tags)
+ case TracerSettingKeyConstants.GlobalTagsKey:
+ if (setting.Value is IDictionary { } tags)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GlobalTags_Set);
+ var globalTags = tracerSettings.GlobalTagsInternal;
+ // This is a replacement, so make sure to clear
+ // Could also use a setter
+ globalTags.Clear();
+ foreach (var tag in tags)
{
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_GlobalTags_Set);
- var globalTags = tracerSettings.GlobalTagsInternal;
- // This is a replacement, so make sure to clear
- // Could also use a setter
- globalTags.Clear();
- foreach (var tag in tags)
- {
- globalTags[tag.Key] = tag.Value;
- }
+ globalTags[tag.Key] = tag.Value;
}
+ }
- break;
+ break;
- case TracerSettingKeyConstants.HttpClientErrorCodesKey:
- if (setting.Value is IEnumerable clientErrorCodes)
- {
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetHttpClientErrorStatusCodes);
- tracerSettings.SetHttpClientErrorStatusCodesInternal(clientErrorCodes);
- }
+ case TracerSettingKeyConstants.HttpClientErrorCodesKey:
+ if (setting.Value is IEnumerable clientErrorCodes)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetHttpClientErrorStatusCodes);
+ tracerSettings.SetHttpClientErrorStatusCodesInternal(clientErrorCodes);
+ }
- break;
+ break;
- case TracerSettingKeyConstants.HttpServerErrorCodesKey:
- if (setting.Value is IEnumerable serverErrorCodes)
- {
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetHttpServerErrorStatusCodes);
- tracerSettings.SetHttpServerErrorStatusCodesInternal(serverErrorCodes);
- }
+ case TracerSettingKeyConstants.HttpServerErrorCodesKey:
+ if (setting.Value is IEnumerable serverErrorCodes)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetHttpServerErrorStatusCodes);
+ tracerSettings.SetHttpServerErrorStatusCodesInternal(serverErrorCodes);
+ }
- break;
+ break;
- case TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_KafkaCreateConsumerScopeEnabled_Set);
- tracerSettings.KafkaCreateConsumerScopeEnabledInternal = (bool)setting.Value!;
- break;
+ case TracerSettingKeyConstants.KafkaCreateConsumerScopeEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_KafkaCreateConsumerScopeEnabled_Set);
+ tracerSettings.KafkaCreateConsumerScopeEnabledInternal = (bool)setting.Value!;
+ break;
- case TracerSettingKeyConstants.LogsInjectionEnabledKey:
+ case TracerSettingKeyConstants.LogsInjectionEnabledKey:
#pragma warning disable DD0002 // This API is only for public usage and should not be called internally (there's no internal version currently)
- tracerSettings.LogsInjectionEnabled = (bool)setting.Value!;
+ tracerSettings.LogsInjectionEnabled = (bool)setting.Value!;
#pragma warning restore DD0002
- break;
+ break;
- case TracerSettingKeyConstants.ServiceNameKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_ServiceName_Set);
- tracerSettings.ServiceNameInternal = setting.Value as string;
- break;
+ case TracerSettingKeyConstants.ServiceNameKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_ServiceName_Set);
+ tracerSettings.ServiceNameInternal = setting.Value as string;
+ break;
- case TracerSettingKeyConstants.ServiceNameMappingsKey:
- if (setting.Value is Dictionary mappings)
- {
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetServiceNameMappings);
- tracerSettings.SetServiceNameMappingsInternal(mappings);
- }
+ case TracerSettingKeyConstants.ServiceNameMappingsKey:
+ if (setting.Value is Dictionary mappings)
+ {
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_SetServiceNameMappings);
+ tracerSettings.SetServiceNameMappingsInternal(mappings);
+ }
- break;
-
- case TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_MaxTracesSubmittedPerSecond_Set);
- tracerSettings.MaxTracesSubmittedPerSecondInternal = (int)setting.Value!;
- break;
-
- case TracerSettingKeyConstants.ServiceVersionKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_ServiceVersion_Set);
- tracerSettings.ServiceVersionInternal = setting.Value as string;
- break;
-
- case TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_StartupDiagnosticLogEnabled_Set);
- tracerSettings.StartupDiagnosticLogEnabledInternal = (bool)setting.Value!;
- break;
-
- case TracerSettingKeyConstants.StatsComputationEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_StatsComputationEnabled_Set);
- tracerSettings.StatsComputationEnabledInternal = (bool)setting.Value!;
- break;
-
- case TracerSettingKeyConstants.TraceEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_TraceEnabled_Set);
- tracerSettings.TraceEnabledInternal = (bool)setting.Value!;
- break;
-
- case TracerSettingKeyConstants.TracerMetricsEnabledKey:
- TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_TracerMetricsEnabled_Set);
- tracerSettings.TracerMetricsEnabledInternal = (bool)setting.Value!;
- break;
-
- case TracerSettingKeyConstants.IntegrationSettingsKey:
- UpdateIntegrations(tracerSettings, setting.Value as Dictionary);
- break;
-
- default:
- Log.Warning("Unknown manual instrumentation key '{Key}' provided. Ignoring value '{Value}'", setting.Key, setting.Value);
- break;
- }
-#pragma warning restore DD0002
+ break;
+
+ case TracerSettingKeyConstants.MaxTracesSubmittedPerSecondKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_MaxTracesSubmittedPerSecond_Set);
+ tracerSettings.MaxTracesSubmittedPerSecondInternal = (int)setting.Value!;
+ break;
+
+ case TracerSettingKeyConstants.ServiceVersionKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_ServiceVersion_Set);
+ tracerSettings.ServiceVersionInternal = setting.Value as string;
+ break;
+
+ case TracerSettingKeyConstants.StartupDiagnosticLogEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_StartupDiagnosticLogEnabled_Set);
+ tracerSettings.StartupDiagnosticLogEnabledInternal = (bool)setting.Value!;
+ break;
+
+ case TracerSettingKeyConstants.StatsComputationEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_StatsComputationEnabled_Set);
+ tracerSettings.StatsComputationEnabledInternal = (bool)setting.Value!;
+ break;
+
+ case TracerSettingKeyConstants.TraceEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_TraceEnabled_Set);
+ tracerSettings.TraceEnabledInternal = (bool)setting.Value!;
+ break;
+
+ case TracerSettingKeyConstants.TracerMetricsEnabledKey:
+ TelemetryFactory.Metrics.Record(PublicApiUsage.TracerSettings_TracerMetricsEnabled_Set);
+ tracerSettings.TracerMetricsEnabledInternal = (bool)setting.Value!;
+ break;
+
+ case TracerSettingKeyConstants.IntegrationSettingsKey:
+ UpdateIntegrations(tracerSettings, setting.Value as Dictionary);
+ break;
+
+ default:
+ Log.Warning("Unknown manual instrumentation key '{Key}' provided. Ignoring value '{Value}'", setting.Key, setting.Value);
+ break;
}
+#pragma warning restore DD0002
}
static void UpdateIntegrations(TracerSettings settings, Dictionary? updated)
@@ -250,24 +248,31 @@ static void UpdateIntegrations(TracerSettings settings, Dictionary OnMethodEnd(TTarget
// The manual instrumentation returns null by default, so can re-use the return value here
// (Not ideal for clarity, but generics prevent returning null directly)
- return scope is null
- ? new CallTargetReturn(returnValue)
- : new CallTargetReturn((TReturn)ScopeHelper.CreateManualScope(scope).Proxy);
+ return new CallTargetReturn(state.Scope.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartActiveImplementationIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartActiveImplementationIntegration.cs
index 1cdaa82c833a..040af724f078 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartActiveImplementationIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartActiveImplementationIntegration.cs
@@ -9,6 +9,7 @@
using System.ComponentModel;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Tracer;
@@ -48,8 +49,7 @@ internal static CallTargetState OnMethodBegin(TTarget ins
internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn returnValue, Exception? exception, in CallTargetState state)
{
- // The return value is a "manual scope" proxy that we reverse duck type as an IScope and set on the return value's
- var proxy = (TReturn)ScopeHelper.CreateManualScope(state.Scope!).Proxy;
- return new CallTargetReturn(proxy);
+ // Duck cast Scope as an IScope (DataDog.Trace.Manual) and return it
+ return new CallTargetReturn(state.Scope.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartSpanIntegration.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartSpanIntegration.cs
index 8eeef911a96a..d6fe7331f4ba 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartSpanIntegration.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/Tracer/StartSpanIntegration.cs
@@ -8,6 +8,7 @@
using System.ComponentModel;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
using Datadog.Trace.ClrProfiler.CallTarget;
+using Datadog.Trace.DuckTyping;
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Tracer;
@@ -44,8 +45,7 @@ internal static CallTargetState OnMethodBegin(TTarget ins
internal static CallTargetReturn OnMethodEnd(TTarget instance, TReturn returnValue, Exception exception, in CallTargetState state)
{
- // The return value is a "manual span" proxy that we reverse duck type as an IScope and set on the return value
- var proxy = (TReturn)ScopeHelper.CreateManualSpan((Span)state.State!).Proxy;
- return new CallTargetReturn(proxy);
+ // Duck cast Span as an ISpan (DataDog.Trace.Manual) and return it
+ return new CallTargetReturn(state.State.DuckCast());
}
}
diff --git a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/TracerSettingKeyConstants.cs b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/TracerSettingKeyConstants.cs
index c5ca78d95d82..a3c61dd1bff0 100644
--- a/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/TracerSettingKeyConstants.cs
+++ b/tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/ManualInstrumentation/TracerSettingKeyConstants.cs
@@ -9,26 +9,30 @@ namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation;
internal class TracerSettingKeyConstants
{
+ // These keys are used when sending from manual to automatic, but not in reverse
public const string IsFromDefaultSourcesKey = "IsFromDefaultSources";
- public const string IntegrationSettingsKey = "IntegrationSettings";
+ public const string HttpClientErrorCodesKey = "DD_HTTP_CLIENT_ERROR_STATUSES";
+ public const string HttpServerErrorCodesKey = "DD_HTTP_SERVER_ERROR_STATUSES";
+ public const string ServiceNameMappingsKey = "DD_TRACE_SERVICE_MAPPING";
+
+ // These keys are used when sending from automatic to manual, but not in reverse
+ public const string DiagnosticSourceEnabledKey = "DD_DIAGNOSTIC_SOURCE_ENABLED";
+ // These are used in both directions
+ public const string IntegrationSettingsKey = "IntegrationSettings";
public const string AgentUriKey = "DD_TRACE_AGENT_URL";
public const string AnalyticsEnabledKey = "DD_TRACE_ANALYTICS_ENABLED";
public const string CustomSamplingRules = "DD_TRACE_SAMPLING_RULES";
- public const string DiagnosticSourceEnabledKey = "DD_DIAGNOSTIC_SOURCE_ENABLED";
public const string DisabledIntegrationNamesKey = "DD_DISABLED_INTEGRATIONS";
public const string EnvironmentKey = "DD_ENV";
public const string GlobalSamplingRateKey = "DD_TRACE_SAMPLE_RATE";
public const string GlobalTagsKey = "DD_TAGS";
public const string GrpcTags = "DD_TRACE_GRPC_TAGS";
public const string HeaderTags = "DD_TRACE_HEADER_TAGS";
- public const string HttpClientErrorCodesKey = "DD_HTTP_CLIENT_ERROR_STATUSES";
- public const string HttpServerErrorCodesKey = "DD_HTTP_SERVER_ERROR_STATUSES";
public const string KafkaCreateConsumerScopeEnabledKey = "DD_TRACE_KAFKA_CREATE_CONSUMER_SCOPE_ENABLED";
public const string LogsInjectionEnabledKey = "DD_LOGS_INJECTION";
public const string MaxTracesSubmittedPerSecondKey = "DD_TRACE_RATE_LIMIT";
public const string ServiceNameKey = "DD_SERVICE";
- public const string ServiceNameMappingsKey = "DD_TRACE_SERVICE_MAPPING";
public const string ServiceVersionKey = "DD_VERSION";
public const string StartupDiagnosticLogEnabledKey = "DD_TRACE_STARTUP_LOGS";
public const string StatsComputationEnabledKey = "DD_TRACE_STATS_COMPUTATION_ENABLED";
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 d52e4be218b0..ba7216acbfce 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
@@ -164,6 +164,9 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginFailureEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Boolean", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AddBenchmarkData"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkMeasureType", "System.String", "Datadog.Trace.Ci.BenchmarkDiscreteStats&"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetBenchmarkMetadata"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkHostInfo&", "Datadog.Trace.Ci.BenchmarkJobInfo&"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetParameters"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.TestParameters"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestModule"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestModule", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestSession"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalGetOrCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestSession", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]", "System.Boolean"), 6, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.GlobalSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetDebugEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"), 0, 1),
@@ -172,6 +175,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Enabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Nullable`1[System.Boolean]"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_IntegrationName"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettingsCollection"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Item"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Configuration.ImmutableIntegrationSettings", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AgentUri"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Uri"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AnalyticsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_CustomSamplingRules"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Environment"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"), 0, 1),
@@ -219,7 +223,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_StatsComputationEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TraceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TracerMetricsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"), 0, 1),
- new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("set_DiagnosticSourceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ExtensionMethods.SpanExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetTraceSamplingPriority"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.ISpan", "Datadog.Trace.SamplingPriority"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.SpanContextExtractor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(".ctor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"), 0, 1),
@@ -743,6 +747,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"
@@ -751,6 +758,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"
@@ -798,7 +806,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"
- or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"
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 67a36dd7b363..f429247ad291 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
@@ -174,6 +174,9 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginFailureEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Boolean", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AddBenchmarkData"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkMeasureType", "System.String", "Datadog.Trace.Ci.BenchmarkDiscreteStats&"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetBenchmarkMetadata"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkHostInfo&", "Datadog.Trace.Ci.BenchmarkJobInfo&"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetParameters"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.TestParameters"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestModule"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestModule", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestSession"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalGetOrCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestSession", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]", "System.Boolean"), 6, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.GlobalSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetDebugEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"), 0, 1),
@@ -182,6 +185,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Enabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Nullable`1[System.Boolean]"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_IntegrationName"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettingsCollection"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Item"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Configuration.ImmutableIntegrationSettings", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AgentUri"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Uri"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AnalyticsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_CustomSamplingRules"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Environment"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"), 0, 1),
@@ -229,7 +233,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_StatsComputationEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TraceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TracerMetricsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"), 0, 1),
- new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("set_DiagnosticSourceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ExtensionMethods.SpanExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetTraceSamplingPriority"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.ISpan", "Datadog.Trace.SamplingPriority"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.SpanContextExtractor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(".ctor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"), 0, 1),
@@ -769,6 +773,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"
@@ -777,6 +784,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"
@@ -824,7 +832,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"
- or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"
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 2d8f1d1a3021..19248cd444a0 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
@@ -171,6 +171,9 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginFailureEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Boolean", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AddBenchmarkData"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkMeasureType", "System.String", "Datadog.Trace.Ci.BenchmarkDiscreteStats&"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetBenchmarkMetadata"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkHostInfo&", "Datadog.Trace.Ci.BenchmarkJobInfo&"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetParameters"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.TestParameters"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestModule"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestModule", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestSession"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalGetOrCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestSession", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]", "System.Boolean"), 6, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.GlobalSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetDebugEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"), 0, 1),
@@ -179,6 +182,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Enabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Nullable`1[System.Boolean]"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_IntegrationName"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettingsCollection"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Item"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Configuration.ImmutableIntegrationSettings", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AgentUri"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Uri"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AnalyticsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_CustomSamplingRules"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Environment"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"), 0, 1),
@@ -226,7 +230,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_StatsComputationEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TraceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TracerMetricsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"), 0, 1),
- new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("set_DiagnosticSourceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ExtensionMethods.SpanExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetTraceSamplingPriority"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.ISpan", "Datadog.Trace.SamplingPriority"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.SpanContextExtractor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(".ctor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"), 0, 1),
@@ -761,6 +765,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"
@@ -769,6 +776,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"
@@ -816,7 +824,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"
- or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"
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 2d8f1d1a3021..19248cd444a0 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
@@ -171,6 +171,9 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginFailureEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Boolean", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.AppSec.EventTrackingSdk"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("TrackUserLoginSuccessEvent"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.String", "System.Collections.Generic.IDictionary`2[System.String,System.String]"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("AddBenchmarkData"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkMeasureType", "System.String", "Datadog.Trace.Ci.BenchmarkDiscreteStats&"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetBenchmarkMetadata"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.BenchmarkHostInfo&", "Datadog.Trace.Ci.BenchmarkJobInfo&"), 4, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetParameters"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.Ci.ITest", "Datadog.Trace.Ci.TestParameters"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestModule"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestModule", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]"), 5, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Ci.TestSession"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("InternalGetOrCreate"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Ci.TestSession", "System.String", "System.String", "System.String", "System.Nullable`1[System.DateTimeOffset]", "System.Boolean"), 6, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.GlobalSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetDebugEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"), 0, 1),
@@ -179,6 +182,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Enabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Nullable`1[System.Boolean]"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_IntegrationName"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableIntegrationSettingsCollection"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Item"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("Datadog.Trace.Configuration.ImmutableIntegrationSettings", "System.String"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AgentUri"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Uri"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_AnalyticsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_CustomSamplingRules"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.ImmutableTracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_Environment"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.String"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"), 0, 1),
@@ -226,7 +230,7 @@ static InstrumentationDefinitions()
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_StatsComputationEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TraceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("get_TracerMetricsEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Boolean"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"), 0, 1),
- new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"), 0, 1),
+ new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("PopulateDictionary"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Collections.Generic.Dictionary`2[System.String,System.Object]", "System.Boolean"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Configuration.TracerSettings"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("set_DiagnosticSourceEnabled"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "System.Boolean"), 2, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ExtensionMethods.SpanExtensions"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("SetTraceSamplingPriority"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void", "Datadog.Trace.ISpan", "Datadog.Trace.SamplingPriority"), 3, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"), 0, 1),
new (NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.Manual"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.SpanContextExtractor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(".ctor"), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16StringArray("System.Void"), 1, 3, 0, 0, 3, 65535, 65535, NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String(assemblyFullName), NativeCallTargetUnmanagedMemoryHelper.AllocateAndWriteUtf16String("Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"), 0, 1),
@@ -761,6 +765,9 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginFailureEventMetadataIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.AppSec.EventTrackingSdkTrackUserLoginSuccessEventMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsAddBenchmarkDataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetBenchmarkMetadataIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestExtensionsSetParametersIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestModuleInternalCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.TestSessionInternalGetOrCreateIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.GlobalSettingsSetDebugEnabledIntegration"
@@ -769,6 +776,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.EnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettings.IntegrationNameGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableIntegrationSettingsCollectionIndexerIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AgentUriIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.AnalyticsEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.CustomSamplingRulesGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.ImmutableTracerSettings.EnvironmentGetIntegration"
@@ -816,7 +824,7 @@ internal static bool IsInstrumentedAssembly(string assemblyName)
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.StatsComputationEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TraceEnabledGetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.TracerMetricsEnabledGetIntegration"
- or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettingsPopulateDictionaryIntegration"
+ or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.PopulateDictionaryIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Configuration.TracerSettings.DiagnosticSourceEnabledSetIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Extensions.SpanExtensionsSetTraceSamplingPriorityIntegration"
or "Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Propagators.SpanContextExtractorConstructorIntegration"
diff --git a/tracer/src/Datadog.Trace/SpanContextExtractor.cs b/tracer/src/Datadog.Trace/SpanContextExtractor.cs
index 3781f1776c79..09760332b98a 100644
--- a/tracer/src/Datadog.Trace/SpanContextExtractor.cs
+++ b/tracer/src/Datadog.Trace/SpanContextExtractor.cs
@@ -45,7 +45,7 @@ internal SpanContextExtractor(bool unusedParamNotToUsePublicApi)
return ExtractInternal(carrier, getter);
}
- internal static ISpanContext? ExtractInternal(TCarrier carrier, Func> getter)
+ internal static SpanContext? ExtractInternal(TCarrier carrier, Func> getter)
{
var spanContext = SpanContextPropagator.Instance.Extract(carrier, getter);
diff --git a/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs b/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs
index da7f43e064fa..33f3c15d1c37 100644
--- a/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs
+++ b/tracer/src/Datadog.Trace/Telemetry/Metrics/IntegrationIdExtensions.cs
@@ -75,6 +75,7 @@ public static MetricTags.IntegrationName GetMetricTag(this IntegrationId integra
IntegrationId.TestPlatformAssemblyResolver => MetricTags.IntegrationName.TestPlatformAssemblyResolver,
IntegrationId.StackTraceLeak => MetricTags.IntegrationName.StackTraceLeak,
IntegrationId.XpathInjection => MetricTags.IntegrationName.XpathInjection,
+ IntegrationId.ReflectionInjection => MetricTags.IntegrationName.ReflectionInjection,
IntegrationId.DatadogTraceManual => MetricTags.IntegrationName.DatadogTraceManual,
_ => throw new InvalidOperationException($"Unknown IntegrationID {integrationId}"), // dangerous, but we test it will never be called
};
diff --git a/tracer/test/Datadog.Trace.Tests/ManualInstrumentation/DuckTypingTests.cs b/tracer/test/Datadog.Trace.Tests/ManualInstrumentation/DuckTypingTests.cs
index 5bb9c0f9650b..a75b9acaa8ca 100644
--- a/tracer/test/Datadog.Trace.Tests/ManualInstrumentation/DuckTypingTests.cs
+++ b/tracer/test/Datadog.Trace.Tests/ManualInstrumentation/DuckTypingTests.cs
@@ -5,10 +5,12 @@
extern alias DatadogTraceManual;
+using System;
using Datadog.Trace.Agent;
using Datadog.Trace.Ci;
+using Datadog.Trace.Ci.Tagging;
+using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci;
using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Ci.Proxies;
-using Datadog.Trace.ClrProfiler.AutoInstrumentation.ManualInstrumentation.Proxies;
using Datadog.Trace.Configuration;
using Datadog.Trace.DuckTyping;
using Datadog.Trace.Sampling;
@@ -16,13 +18,15 @@
using FluentAssertions;
using Moq;
using Xunit;
-using BenchmarkHostInfo = DatadogTraceManual::Datadog.Trace.Ci.BenchmarkHostInfo;
-using BenchmarkJobInfo = DatadogTraceManual::Datadog.Trace.Ci.BenchmarkJobInfo;
-using CustomIScope = DatadogTraceManual::Datadog.Trace.IScope;
-using CustomISpan = DatadogTraceManual::Datadog.Trace.ISpan;
-using CustomISpanContext = DatadogTraceManual::Datadog.Trace.ISpanContext;
-using ITestSession = DatadogTraceManual::Datadog.Trace.Ci.ITestSession;
-using TestParameters = DatadogTraceManual::Datadog.Trace.Ci.TestParameters;
+using ManualBenchmarkDiscreteStats = DatadogTraceManual::Datadog.Trace.Ci.BenchmarkDiscreteStats;
+using ManualBenchmarkHostInfo = DatadogTraceManual::Datadog.Trace.Ci.BenchmarkHostInfo;
+using ManualBenchmarkJobInfo = DatadogTraceManual::Datadog.Trace.Ci.BenchmarkJobInfo;
+using ManualIScope = DatadogTraceManual::Datadog.Trace.IScope;
+using ManualISpan = DatadogTraceManual::Datadog.Trace.ISpan;
+using ManualISpanContext = DatadogTraceManual::Datadog.Trace.ISpanContext;
+using ManualITest = DatadogTraceManual::Datadog.Trace.Ci.ITest;
+using ManualITestSession = DatadogTraceManual::Datadog.Trace.Ci.ITestSession;
+using ManualTestParameters = DatadogTraceManual::Datadog.Trace.Ci.TestParameters;
using TestStatus = DatadogTraceManual::Datadog.Trace.Ci.TestStatus;
namespace Datadog.Trace.Tests.ManualInstrumentation;
@@ -41,43 +45,49 @@ public DuckTypingTests()
}
[Fact]
- public void CanDuckTypeManualSpanContextAsISpanContext()
+ public void CanDuckTypeScopeAsManualIScope()
{
var scope = _tracer.StartActiveInternal("manual");
- var spanContext = scope.Span.Context;
- var proxyObject = ScopeHelper.CreateManualSpanContext(spanContext);
-
- // verify properties are ok
- var proxy = proxyObject.Proxy as CustomISpanContext;
- proxy.Should().NotBeNull();
- proxy.ServiceName.Should().Be(spanContext.ServiceName);
- proxy.SpanId.Should().Be(spanContext.SpanId);
- proxy.TraceId.Should().Be(spanContext.TraceId);
- }
+ var span = scope.Span;
+ var spanContext = span.Context;
- [Fact]
- public void CanDuckTypeManualScopeAsIScope()
- {
- var scope = _tracer.StartActiveInternal("manual");
- var proxyObject = ScopeHelper.CreateManualScope(scope);
-
- // verify properties are ok
- var proxy = proxyObject.Proxy as CustomIScope;
- proxy.Should().NotBeNull();
- proxy.Span.Should().NotBeNull();
- proxy.Close();
- proxy.Dispose();
+ var manualScope = scope.DuckCast();
+
+ // call all the properties to check for duck typing issues
+ var manualSpan = manualScope.Span.Should().BeAssignableTo().Subject;
+ manualSpan.SpanId.Should().Be(span.SpanId);
+ manualSpan.SetException(new Exception("MyException"));
+ manualSpan.Error.Should().Be(span.Error).And.BeTrue();
+ manualSpan.Type.Should().Be(span.Type);
+ manualSpan.OperationName.Should().Be(span.OperationName);
+ manualSpan.ResourceName.Should().Be(span.ResourceName);
+ manualSpan.ServiceName.Should().Be(span.ServiceName);
+ manualSpan.TraceId.Should().Be(span.TraceId);
+ // This won't return the _same_ object, because it's a struct duck type.
+ // Should still refer to the same underlying span though
+ var returned = manualSpan.SetTag("Test", "SomeValue");
+ returned.Should().BeAssignableTo().Subject.Instance.Should().BeSameAs(span);
+ manualSpan.GetTag("Test").Should().Be("SomeValue");
+ span.GetTag("Test").Should().Be("SomeValue"); // check it was mirrored
+
+ var manualSpanContext = manualSpan.Context.Should().BeAssignableTo().Subject;
+ manualSpanContext.SpanId.Should().Be(spanContext.SpanId);
+ manualSpanContext.ServiceName.Should().Be(spanContext.ServiceName);
+ manualSpanContext.TraceId.Should().Be(spanContext.TraceId);
+
+ manualScope.Close();
+ manualScope.Dispose();
}
[Fact]
public void CanDuckTypeManualTestSessionAsISession()
{
- var session = TestSession.GetOrCreate("blah");
- var proxy = (ITestSession)TestObjectsHelper.CreateTestSession(session);
- proxy.Should().NotBeNull();
+ var autoSession = TestSession.GetOrCreate("blah");
+
+ var session = autoSession.DuckCast();
// call the methods to make sure it works
- var module = proxy.CreateModule("somemodule");
+ var module = session.CreateModule("somemodule");
module.Should().NotBeNull();
var suite = module.GetOrCreateSuite("mysuite");
@@ -86,12 +96,46 @@ public void CanDuckTypeManualTestSessionAsISession()
var test = suite.CreateTest("mytest");
test.Should().NotBeNull();
- test.SetParameters(new TestParameters { Arguments = new(), Metadata = new() });
- test.SetBenchmarkMetadata(new BenchmarkHostInfo() { RuntimeVersion = "123" }, new BenchmarkJobInfo() { Description = "weeble" });
+ var stats = new ManualBenchmarkDiscreteStats(100, 100, 100, 100, 100, 0, 0, 0, 0, 100, 100, 100);
+ var statsDuckType = stats.DuckCast();
+ TestExtensionsAddBenchmarkDataIntegration.OnMethodBegin