Skip to content

[SVLS-9186] add Windows Function App support to aas instrument#2357

Merged
ava-silver merged 1 commit into
masterfrom
ava.silver/svls-9186/windows-dotnet-functions-support
Jun 25, 2026
Merged

[SVLS-9186] add Windows Function App support to aas instrument#2357
ava-silver merged 1 commit into
masterfrom
ava.silver/svls-9186/windows-dotnet-functions-support

Conversation

@ava-silver

@ava-silver ava-silver commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What and why?

aas instrument treated every site like a Web App, so Function Apps fell through the platform checks and got the wrong handling. This adds first-class Function App support:

  • Windows .NET Function Apps install the same site extension as Windows Web Apps. On a deployment slot there's a wrinkle from datadog-aas-extension#457: the Functions runtime holds file locks on the SiteExtensions directory, so Kudu's MoveDirectory step fails intermittently during the install. Setting WEBSITE_PRIVATE_EXTENSIONS=0 makes the runtime release those locks. It is committed before the install and registered as a sticky slot setting so it doesn't follow a swap into production.
  • Windows Function Apps on Node or Java aren't supported via the extension -- the command exits with an error pointing to the Azure Functions docs.
  • Windows Function Apps on a Consumption / Flex Consumption plan aren't supported -- the extension requires a Dedicated (App Service) or Premium plan, so the command exits with the same redirect rather than installing an extension that will never produce telemetry.
  • Linux Function Apps aren't supported -- the command exits with the same redirect instead of silently falling through to the sidecar path.

Web App behavior is unchanged. Builds on the sticky-slot helpers from the parent PR.

How?

  • common.ts:
    • Adds isFunctionApp, isWindowsFunctionApp, isConsumptionPlan, the WEBSITE_PRIVATE_EXTENSIONS constant, and AZURE_FUNCTIONS_DOCS_URL.
    • isConsumptionPlan reads site.sku (the plan tier name, e.g. Dynamic for Consumption, FlexConsumption for Flex Consumption) off the site object the command already fetches -- no extra API call.
    • getEnvVars(config, site, webApp) derives containerization from the site and injects WEBSITE_PRIVATE_EXTENSIONS=0 for Windows Function App slots, so the lock-release setting is part of the settings written before the install.
    • Generalizes the parent PR's registerStickySlotSettings into mutateStickySlotSettings(..., mode: 'add' | 'remove', ...), so the same single-read-modify-write path both registers settings (instrument) and unregisters them (uninstrument).
    • Moves the shared ProcessResult type and a stickySlotSettings helper here so both commands use them.
  • instrument.ts:
    • Rejects Linux Function Apps before the Windows branch. Inside the Windows Function App branch, rejects Consumption/Flex Consumption plans and non-.NET runtimes with the redirect.
    • instrumentExtension/instrumentSidecar take the resolved site and write app settings before the extension install (previously the write was dispatched and only awaited afterward). This gives the lock-release setting the ordering it needs.
    • On a .NET Function App slot, pins WEBSITE_PRIVATE_EXTENSIONS sticky alongside DD_ENV.
  • uninstrument.ts:
    • Returns ProcessResult and, on a Windows Function App slot, removes the WEBSITE_PRIVATE_EXTENSIONS app setting and unregisters it sticky (mutateStickySlotSettings in remove mode, aggregated once per site). DD_ENV is intentionally left sticky.

Testing

Validated end-to-end against a live Windows .NET (isolated) Function App on a Dedicated (App Service) plan: deployed an HTTP-triggered function, ran aas instrument --windows-runtime dotnet, drove traffic, and confirmed traces in Datadog.

While doing this I also confirmed the plan requirement empirically: on a Consumption plan the extension installs but never injects the profiler (CORECLR_* env vars are absent from the worker), so no traces flow -- which is why the command now rejects Consumption/Flex Consumption up front. On the Dedicated plan, traces flowed with WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED left at its default, so no extra placeholder configuration is needed.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

ava-silver commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 15, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 222cbaf | Docs | Datadog PR Page | Give us feedback!

@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from bbb595f to 675be60 Compare June 22, 2026 19:46
@ava-silver ava-silver added bug Something isn't working serverless Related to [aas, cloud-run, lambda, stepfunctions] labels Jun 22, 2026
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from 705aa92 to 88e2ce2 Compare June 22, 2026 21:32
@ava-silver
ava-silver changed the base branch from master to graphite-base/2357 June 22, 2026 21:40
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from 88e2ce2 to ada4aef Compare June 22, 2026 21:41
@ava-silver
ava-silver force-pushed the graphite-base/2357 branch from df67891 to 7556a51 Compare June 22, 2026 21:41
@ava-silver
ava-silver changed the base branch from graphite-base/2357 to ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation June 22, 2026 21:41
@ava-silver
ava-silver changed the base branch from ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation to graphite-base/2357 June 23, 2026 14:10
@ava-silver
ava-silver force-pushed the graphite-base/2357 branch from 7556a51 to 2639e03 Compare June 23, 2026 14:11
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from ada4aef to 54924fe Compare June 23, 2026 14:11
@ava-silver
ava-silver changed the base branch from graphite-base/2357 to ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation June 23, 2026 14:11
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from 54924fe to d471c5b Compare June 23, 2026 20:43
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch from 8bc19ef to 9703991 Compare June 23, 2026 21:02
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from d471c5b to 7bdd25e Compare June 23, 2026 21:02
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch from 9703991 to f71e945 Compare June 24, 2026 16:32
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch 2 times, most recently from 4354f98 to 1038c8f Compare June 24, 2026 16:56
@ava-silver
ava-silver marked this pull request as ready for review June 24, 2026 19:03
@ava-silver
ava-silver requested review from a team as code owners June 24, 2026 19:03
@ava-silver
ava-silver requested review from Lewis-E and nina9753 June 24, 2026 19:03
return envVars
}

export const AZURE_FUNCTIONS_DOCS_URL = 'https://docs.datadoghq.com/serverless/azure_functions'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want https://docs.datadoghq.com/serverless/azure_functions for this url, or https://docs.datadoghq.com/serverless/azure_functions/dotnet_extension? The second page is specific to the extension installation, while the first (current value of AZURE_FUNCTIONS_DOCS_URL) is mostly about the compat layer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, for some of the warnings we do want it, but not for all. i'll differentiate the two

@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from a143d04 to 473dd89 Compare June 24, 2026 20:02
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch from 0cf934c to e832323 Compare June 24, 2026 20:02
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch from e832323 to cb356f8 Compare June 24, 2026 20:59
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch 2 times, most recently from 844cb34 to c956523 Compare June 24, 2026 21:01
Base automatically changed from ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation to master June 25, 2026 17:18
@ava-silver
ava-silver force-pushed the ava.silver/svls-9186/windows-dotnet-functions-support branch from c956523 to 222cbaf Compare June 25, 2026 17:21
@ava-silver
ava-silver merged commit 45b0652 into master Jun 25, 2026
34 checks passed
@ava-silver
ava-silver deleted the ava.silver/svls-9186/windows-dotnet-functions-support branch June 25, 2026 20:52
@ava-silver ava-silver mentioned this pull request Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working serverless Related to [aas, cloud-run, lambda, stepfunctions]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants