Skip to content

Commit 186e74f

Browse files
dromanolclaude
andcommitted
[ASM] Log endpoints collection failures as warnings, not errors
Reading EndpointDataSource.Endpoints executes third-party code that can throw for reasons outside our control. In the Azure Functions isolated worker, FunctionsEndpointDataSource builds its endpoints lazily and rejects malformed route templates, so collecting endpoints at Kestrel startup surfaces a RoutePatternException. Endpoints collection is best-effort and the failure does not affect the application, so it should not be reported to telemetry as an error. The other failure paths in the same method already use Log.Warning. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 7a4fb69 commit 186e74f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ internal static CallTargetState OnMethodBegin<TTarget, TApplication>(TTarget ins
5757
}
5858
catch (Exception ex)
5959
{
60-
Log.Error(ex, "API Security: Failed to collect endpoints.");
60+
// Reading EndpointDataSource.Endpoints runs third-party code that can throw for reasons
61+
// outside our control (e.g. the Azure Functions worker builds its endpoints lazily and
62+
// rejects a malformed route template). Endpoints collection is best-effort, so a failure
63+
// here degrades the feature without affecting the application: warn rather than report
64+
// an error to telemetry.
65+
Log.Warning(ex, "API Security: Failed to collect endpoints.");
6166
}
6267

6368
return CallTargetState.GetDefault();

0 commit comments

Comments
 (0)