|
| 1 | +# Azure Functions Skill |
| 2 | + |
| 3 | +A Claude Code skill for working with Azure Functions instrumented with Datadog.AzureFunctions. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +Invoke the skill with `/azure-functions` followed by an optional command: |
| 8 | + |
| 9 | +``` |
| 10 | +/azure-functions # Interactive mode - guided workflow |
| 11 | +/azure-functions build # Build Datadog.AzureFunctions NuGet package |
| 12 | +/azure-functions deploy [app-name] # Deploy to Azure Function App |
| 13 | +/azure-functions test [app-name] # Trigger and verify function |
| 14 | +/azure-functions logs [app-name] # Download and analyze logs |
| 15 | +/azure-functions trace [trace-id] # Analyze specific trace in Datadog |
| 16 | +``` |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +### Build |
| 21 | +- Builds `Datadog.AzureFunctions` NuGet package with your changes |
| 22 | +- Clears NuGet cache |
| 23 | +- Publishes to bundle folder |
| 24 | +- Copies to `D:\temp\nuget` |
| 25 | + |
| 26 | +### Deploy |
| 27 | +- Deploys sample app to Azure Function App |
| 28 | +- Supports all test apps in resource group `lucas.pimentel` |
| 29 | +- Default: `lucasp-premium-linux-isolated-aspnet` |
| 30 | +- Reminds to wait for worker restart |
| 31 | + |
| 32 | +### Test |
| 33 | +- Triggers HTTP endpoint |
| 34 | +- Captures execution timestamp (for log filtering) |
| 35 | +- Verifies HTTP 200 response |
| 36 | + |
| 37 | +### Logs |
| 38 | +- Downloads logs from Azure |
| 39 | +- Extracts to `D:\temp\logs-{timestamp}.zip` |
| 40 | +- Provides timestamp-based filtering commands |
| 41 | +- Identifies host vs worker processes |
| 42 | +- Verifies tracer version |
| 43 | +- Analyzes trace context flow |
| 44 | + |
| 45 | +### Trace |
| 46 | +- Queries Datadog API for specific trace |
| 47 | +- Shows span hierarchy |
| 48 | +- Verifies parent-child relationships |
| 49 | +- Checks process tags (`host` vs `worker`) |
| 50 | + |
| 51 | +## Files |
| 52 | + |
| 53 | +- **SKILL.md** - Main skill definition with workflow steps |
| 54 | +- **log-analysis-guide.md** - Detailed log analysis patterns and grep examples |
| 55 | +- **scripts-reference.md** - Reusable bash/PowerShell scripts for common tasks |
| 56 | +- **README.md** - This file |
| 57 | + |
| 58 | +## Interactive Mode |
| 59 | + |
| 60 | +When invoked without arguments (`/azure-functions`), the skill guides you through: |
| 61 | + |
| 62 | +1. Understanding your goal (new feature, bug fix, trace verification) |
| 63 | +2. Building the NuGet package |
| 64 | +3. Selecting target app |
| 65 | +4. Deploying to Azure |
| 66 | +5. Waiting for worker restart |
| 67 | +6. Testing function execution |
| 68 | +7. Downloading logs |
| 69 | +8. Analyzing results based on your goal |
| 70 | +9. Running verification checklist |
| 71 | + |
| 72 | +## Quick Reference |
| 73 | + |
| 74 | +### Test Function Apps |
| 75 | + |
| 76 | +All apps in resource group `lucas.pimentel`, Canada Central: |
| 77 | + |
| 78 | +- **lucasp-premium-linux-isolated-aspnet** (primary) - .NET 8 Isolated + ASP.NET Core |
| 79 | +- lucasp-premium-linux-isolated - .NET 8 Isolated (no ASP.NET Core) |
| 80 | +- lucasp-premium-linux-inproc - .NET 6 In-Process |
| 81 | +- lucasp-premium-windows-isolated-aspnet - Windows + ASP.NET Core |
| 82 | +- lucasp-premium-windows-isolated - Windows (no ASP.NET Core) |
| 83 | +- lucasp-premium-windows-inproc - Windows In-Process |
| 84 | +- lucasp-consumption-windows-isolated - Windows Consumption |
| 85 | +- lucasp-flex-consumption-isolated - Flex Consumption |
| 86 | + |
| 87 | +### Sample Applications |
| 88 | + |
| 89 | +- Primary: `D:\source\datadog\serverless-dev-apps\azure\functions\dotnet\isolated-dotnet8-aspnetcore` |
| 90 | +- All: `D:\source\datadog\serverless-dev-apps\azure\functions\dotnet` |
| 91 | + |
| 92 | +### Temporary Directories |
| 93 | + |
| 94 | +- NuGet packages: `D:\temp\nuget` |
| 95 | +- Log downloads: `D:\temp\logs-*.zip` |
| 96 | +- Trace payloads: `D:\temp\trace_payload_*.json` |
| 97 | + |
| 98 | +## Documentation References |
| 99 | + |
| 100 | +- `docs/development/AzureFunctions.md` - Complete Azure Functions integration guide |
| 101 | +- `docs/development/for-ai/AzureFunctions-Architecture.md` - Architecture deep dive |
| 102 | +- `D:\source\datadog\CLAUDE.md` - Azure Functions testing workflow |
| 103 | + |
| 104 | +## Examples |
| 105 | + |
| 106 | +### Build and deploy to primary app |
| 107 | +``` |
| 108 | +/azure-functions build |
| 109 | +/azure-functions deploy |
| 110 | +``` |
| 111 | + |
| 112 | +### Test specific app and download logs |
| 113 | +``` |
| 114 | +/azure-functions test lucasp-premium-linux-isolated |
| 115 | +/azure-functions logs lucasp-premium-linux-isolated |
| 116 | +``` |
| 117 | + |
| 118 | +### Analyze specific trace |
| 119 | +``` |
| 120 | +/azure-functions trace 68e948220000000047fef7bad8bb854e |
| 121 | +``` |
| 122 | + |
| 123 | +### Full workflow (interactive) |
| 124 | +``` |
| 125 | +/azure-functions |
| 126 | +``` |
| 127 | + |
| 128 | +## Verification Checklist |
| 129 | + |
| 130 | +After deployment and testing, the skill helps verify: |
| 131 | + |
| 132 | +- [ ] Function responds successfully (HTTP 200) |
| 133 | +- [ ] Worker loaded correct tracer version |
| 134 | +- [ ] Host and worker spans share same trace ID |
| 135 | +- [ ] Span parent-child relationships are correct |
| 136 | +- [ ] Process tags are correct (`aas.function.process:host` or `worker`) |
| 137 | +- [ ] No error logs at execution timestamp |
| 138 | +- [ ] AsyncLocal context flows correctly (if debugging context issues) |
| 139 | + |
| 140 | +## Common Troubleshooting |
| 141 | + |
| 142 | +The skill provides guidance for: |
| 143 | + |
| 144 | +- Function not responding after deployment |
| 145 | +- Wrong tracer version after deployment |
| 146 | +- Traces not appearing in Datadog |
| 147 | +- Separate traces (span parenting issues) |
| 148 | +- Missing debug logs |
| 149 | +- AsyncLocal context flow issues |
| 150 | + |
| 151 | +## Tips |
| 152 | + |
| 153 | +- Always use timestamp filtering when analyzing logs |
| 154 | +- Verify tracer version before investigating behavior |
| 155 | +- Follow trace IDs from host to worker |
| 156 | +- Check span parent-child relationships |
| 157 | +- Download logs after each test execution |
| 158 | +- Enable debug logging for detailed investigation |
0 commit comments