Skip to content

Commit bc51a8e

Browse files
Lewis-Eclaude
andcommitted
Fix build errors: add DD_SERVERLESS_COMPAT_PATH to ConfigurationKeys, fix ExporterSettings access path
- Add DD_SERVERLESS_COMPAT_PATH to supported-configurations.yaml so the source generator creates ConfigurationKeys.ServerlessCompatPath - Fix integration classes to use the correct property path: Tracer.Instance.Settings.Manager.InitialExporterSettings - Restore using Datadog.Trace.Configuration (needed for IntegrationId) - Remove unused System.Reflection/InteropServices from ExporterSettings Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ded3bd4 commit bc51a8e

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Serverless/CompatibilityLayer_CalculateDogStatsDPipeName_Integration.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using System.ComponentModel;
1111
using Datadog.Trace.ClrProfiler.CallTarget;
12+
using Datadog.Trace.Configuration;
1213
using Datadog.Trace.Logging;
1314

1415
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Serverless
@@ -63,7 +64,7 @@ internal static CallTargetReturn<string> OnMethodEnd<TTarget>(
6364
// Use the tracer's configured pipe name, which in Azure Functions will be the
6465
// unique name generated by ExporterSettings. Fall back to the compat layer's
6566
// own calculated name if the tracer isn't initialized yet.
66-
var pipeName = Tracer.Instance.Settings?.Exporter?.MetricsPipeName ?? returnValue;
67+
var pipeName = Tracer.Instance.Settings?.Manager?.InitialExporterSettings?.MetricsPipeName ?? returnValue;
6768

6869
Log.Debug(
6970
"ServerlessCompat integration: Overriding compat layer DogStatsD pipe name. " +

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Serverless/CompatibilityLayer_CalculateTracePipeName_Integration.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using System.ComponentModel;
1111
using Datadog.Trace.ClrProfiler.CallTarget;
12+
using Datadog.Trace.Configuration;
1213
using Datadog.Trace.Logging;
1314

1415
namespace Datadog.Trace.ClrProfiler.AutoInstrumentation.Serverless
@@ -63,7 +64,7 @@ internal static CallTargetReturn<string> OnMethodEnd<TTarget>(
6364
// Use the tracer's configured pipe name, which in Azure Functions will be the
6465
// unique name generated by ExporterSettings. Fall back to the compat layer's
6566
// own calculated name if the tracer isn't initialized yet.
66-
var pipeName = Tracer.Instance.Settings?.Exporter?.TracesPipeName ?? returnValue;
67+
var pipeName = Tracer.Instance.Settings?.Manager?.InitialExporterSettings?.TracesPipeName ?? returnValue;
6768

6869
Log.Debug(
6970
"ServerlessCompat integration: Overriding compat layer trace pipe name. " +

tracer/src/Datadog.Trace/ClrProfiler/AutoInstrumentation/Serverless/ServerlessCompatPipeNameHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal static bool IsCompatLayerAvailableWithPipeSupport(
7777
// DD_SERVERLESS_COMPAT_PATH overrides the default binary location
7878
// (matches CompatibilityLayer.cs in datadog-serverless-compat-dotnet).
7979
const string defaultCompatBinaryPath = @"C:\home\site\wwwroot\datadog\bin\windows-amd64\datadog-serverless-compat.exe";
80-
var compatBinaryPath = Util.EnvironmentHelpers.GetEnvironmentVariable("DD_SERVERLESS_COMPAT_PATH")
80+
var compatBinaryPath = Util.EnvironmentHelpers.GetEnvironmentVariable(Configuration.ConfigurationKeys.ServerlessCompatPath)
8181
?? defaultCompatBinaryPath;
8282

8383
// Check that the compat DLL exists and has a version that supports named pipes.

tracer/src/Datadog.Trace/Configuration/supported-configurations.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,14 @@ supportedConfigurations:
14681468
Match all spans that start with "cart" without any limits and any operation name.
14691469
"[{"service": "cart*"}]"
14701470
<seealso cref="Datadog.Trace.Configuration.TracerSettings.SpanSamplingRules"/>
1471+
DD_SERVERLESS_COMPAT_PATH:
1472+
- implementation: A
1473+
type: string
1474+
default: null
1475+
const_name: ServerlessCompatPath
1476+
documentation: |-
1477+
Overrides the default path to the serverless compat layer binary.
1478+
Default value is <c>C:\home\site\wwwroot\datadog\bin\windows-amd64\datadog-serverless-compat.exe</c>.
14711479
DD_SYMBOL_DATABASE_BATCH_SIZE_BYTES:
14721480
- implementation: A
14731481
type: int

0 commit comments

Comments
 (0)