Skip to content

Commit eb5be1b

Browse files
[Azure Functions] Add architecture deep dive documentation (#7639)
## Summary of changes Adds comprehensive architectural documentation for Azure Functions Host and .NET Worker relevant to `dd-trace-dotnet` instrumentation. **New**: `docs/development/AzureFunctions-Architecture.md` (922 lines) - Host and Worker architecture, components, and execution pipeline - gRPC communication protocol and message types - Distributed tracing integration (W3C TraceContext, Activity, OpenTelemetry) - Environment variables, configuration, and instrumentation hook points **Updated**: `AGENTS.md` and `docs/development/AzureFunctions.md` with cross-references ## Reason for change Makes it easier to understand Azure Functions internals, navigate source code, identify instrumentation points, and debug issues. ## Implementation details Created by analyzing the [Azure Functions Host](https://github.com/Azure/azure-functions-host) and [.NET Worker](https://github.com/Azure/azure-functions-dotnet-worker) repositories. Includes specific file paths and line numbers for key components. ## Test coverage Documentation only - no code changes. ## Other details Internal developer documentation complementing the existing `AzureFunctions.md` integration guide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
1 parent 85aacf3 commit eb5be1b

File tree

6 files changed

+2361
-8
lines changed

6 files changed

+2361
-8
lines changed

AGENTS.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@
1919
- Loader/home: Build outputs publish a "monitoring home"; the native loader boots the tracer from there.
2020
- Build system: Nuke coordinates .NET builds and CMake/vcpkg for native components.
2121

22+
## NuGet Package Architecture
23+
24+
### Datadog.Trace Package
25+
The `Datadog.Trace` NuGet package provides the **manual instrumentation API** for customers:
26+
- **Contains**: `Datadog.Trace.Manual.dll` - Public API for manual instrumentation
27+
- **Does NOT contain**: Auto-instrumentation code or native profiler binaries
28+
- **Usage**: Reference in application code for manual tracing (e.g., `Tracer.Instance.StartActive()`)
29+
30+
Auto-instrumentation comes from the tracer "monitoring home" deployed separately (via installers, MSI, container images, or specialized packages like `Datadog.AzureFunctions`).
31+
32+
### Datadog.Trace.dll vs Datadog.Trace.Manual.dll
33+
- `Datadog.Trace.dll` - The full managed tracer with all auto-instrumentation code, loaded by the native profiler into instrumented processes
34+
- `Datadog.Trace.Manual.dll` - Lightweight manual instrumentation API packaged in the `Datadog.Trace` NuGet package for customer reference
35+
36+
### Specialized Packages
37+
- **Datadog.AzureFunctions**: Bundles `Datadog.Trace.dll` and native profiler for Azure Functions (see `docs/development/AzureFunctions.md`)
38+
- **Datadog.Monitoring.Distribution**: MSI installer for Windows (IIS, Windows Services)
39+
- Other serverless/platform-specific packages may bundle the full tracer similarly
40+
2241
## Tracer Structure
2342

2443
- `tracer/src/Datadog.Trace` — Core managed tracer library
@@ -199,10 +218,14 @@ tracer/src/Datadog.Trace
199218
- **Setup**: Use Azure App Services Site Extension on Windows Premium/Elastic Premium/Dedicated plans; use `Datadog.AzureFunctions` NuGet package for Linux Consumption/Container Apps
200219
- **Tests**: `BuildAndRunWindowsAzureFunctionsTests` Nuke target; samples under `tracer/test/test-applications/azure-functions/`
201220
- **Dependencies**: `Datadog.AzureFunctions``Datadog.Serverless.Compat` ([datadog-serverless-compat-dotnet](https://github.com/DataDog/datadog-serverless-compat-dotnet)) contains agent executable
221+
- **External Repos**: [Azure Functions Host](https://github.com/Azure/azure-functions-host) and [.NET Worker](https://github.com/Azure/azure-functions-dotnet-worker)
202222

203223
📖 **Load when**: Working on Azure Functions instrumentation or debugging serverless issues
204224
- **`docs/development/AzureFunctions.md`** — In-process vs isolated worker models, instrumentation specifics, ASP.NET Core integration, GRPC context propagation, and debugging guide
205225

226+
📖 **Load when**: Need detailed architectural understanding of Azure Functions internals
227+
- **`docs/development/AzureFunctions-Architecture.md`** — Deep dive into Azure Functions Host and .NET Worker architecture, gRPC protocol, middleware model, distributed tracing integration, environment variables, and instrumentation hook points
228+
206229
📖 **Load when**: Working on AWS Lambda or general serverless instrumentation
207230
- **`docs/development/Serverless.md`** — Serverless instrumentation patterns across cloud providers
208231

@@ -292,8 +315,10 @@ The tracer runs in-process with customer applications and must have minimal perf
292315
- `docs/development/AutomaticInstrumentation.md` — Creating integrations
293316
- `docs/development/DuckTyping.md` — Duck typing guide
294317
- `docs/development/AzureFunctions.md` — Azure Functions integration
318+
- `docs/development/AzureFunctions-Architecture.md` — Azure Functions architecture deep dive
295319
- `docs/development/Serverless.md` — Serverless instrumentation
296320
- `docs/development/UpdatingTheSdk.md` — SDK updates
321+
- `docs/development/QueryingDatadogAPIs.md` — Querying Datadog APIs for debugging (spans, logs)
297322

298323
**CI & Testing:**
299324
- `docs/development/CI/TroubleshootingCIFailures.md` — Investigating build/test failures in Azure DevOps

0 commit comments

Comments
 (0)