You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Azure Functions] Restore files moved by in-process Azure Functions SDK (#7419)
## Summary of changes
Improve support for in-process Azure Functions my restoring the files
moved by the SDK.
## Reason for change
The Azure Functions SDK for in-process functions moves files from
`$(PublishDir)**\*.dll` to `$(PublishDir)bin\` (keeping the directory
structure). This breaks the tracer because the files are not found where
expected. Furthermore, it splits the tracer files into two paths because
it moves only our `.dll` files but not other files, like `.so`,
`loader.confg`, or the agent binaries.
See
https://github.com/Azure/azure-functions-vs-build-sdk/blob/7a3e505c2382ee9c461985baef1603e980740ca6/src/Microsoft.NET.Sdk.Functions.MSBuild/Targets/Microsoft.NET.Sdk.Functions.Publish.targets#L134-L154
## Implementation details
Add a build target that runs after the SDK's
`_GenerateFunctionsAndCopyContentFiles` target. This new target moves
any files in `$(PublishDir)bin\datadog\**\*.dll` back to
`$(PublishDir)datadog\`, maintaining the directory structure.
Directory tree before:
```
.\publish\
├── bin
│ ├── datadog <---- dlls moved to bin/datadog/
│ │ ├── net6.0
│ │ │ └── Datadog.Trace.dll
│ │ ├── win-x64
│ │ │ ├── Datadog.Trace.ClrProfiler.Native.dll
│ │ │ └── Datadog.Tracer.Native.dll
│ │ └── win-x86
│ │ ├── Datadog.Trace.ClrProfiler.Native.dll
│ │ └── Datadog.Tracer.Native.dll
│ ├── (application files)
│ └── ...
├── datadog <---- other tracer files stay in datadog/
│ ├── bin
│ │ ├── linux-amd64
│ │ │ └── datadog-serverless-compat
│ │ └── windows-amd64
│ │ └── datadog-serverless-compat.exe
│ ├── linux-x64
│ │ ├── Datadog.Trace.ClrProfiler.Native.so
│ │ ├── Datadog.Tracer.Native.so
│ │ └── loader.conf
│ ├── net6.0
│ ├── win-x64
│ │ └── loader.conf
│ └── win-x86
│ └── loader.conf
├── <function name>
│ └── function.json
├── <function name>
│ └── function.json
├── ...
│ └── function.json
└── host.json
```
Directory tree after:
```
.\publish\
├── bin
│ ├── (application files)
│ └── ...
├── datadog <---- all tracer files stay in datadog/
│ ├── bin
│ │ ├── linux-amd64
│ │ │ └── datadog-serverless-compat
│ │ └── windows-amd64
│ │ └── datadog-serverless-compat.exe
│ ├── linux-x64
│ │ ├── Datadog.Trace.ClrProfiler.Native.so
│ │ ├── Datadog.Tracer.Native.so
│ │ └── loader.conf
│ ├── net6.0
│ │ └── Datadog.Trace.dll
│ ├── win-x64
│ │ ├── Datadog.Trace.ClrProfiler.Native.dll
│ │ ├── Datadog.Tracer.Native.dll
│ │ └── loader.conf
│ └── win-x86
│ ├── Datadog.Trace.ClrProfiler.Native.dll
│ ├── Datadog.Tracer.Native.dll
│ └── loader.conf
├── <function name>
│ └── function.json
├── <function name>
│ └── function.json
├── ...
│ └── function.json
└── host.json
```
## Test coverage
Tested manually. Will add automated tests before officially supporting
in-process Azure Functions.
## Other details
Fixes APMSVLS-136
<!-- ⚠️ Note:
Where possible, please obtain 2 approvals prior to merging. Unless
CODEOWNERS specifies otherwise, for external teams it is typically best
to have one review from a team member, and one review from apm-dotnet.
Trivial changes do not require 2 reviews.
MergeQueue is NOT enabled in this repository. If you have write access
to the repo, the PR has 1-2 approvals (see above), and all of the
required checks have passed, you can use the Squash and Merge button to
merge the PR. If you don't have write access, or you need help, reach
out in the #apm-dotnet channel in Slack.
-->
---------
Co-authored-by: Copilot <[email protected]>
<!-- This build step is a workaround for the Azure Functions SDK moving our *.dll files from datadog/ to bin/datadog/
2
+
See https://github.com/Azure/azure-functions-vs-build-sdk/blob/7a3e505c2382ee9c461985baef1603e980740ca6/src/Microsoft.NET.Sdk.Functions.MSBuild/Targets/Microsoft.NET.Sdk.Functions.Publish.targets#L134-L154 -->
0 commit comments