Skip to content

[SVLS-9256] auto-mark dd env sticky on slot instrumentation#2340

Merged
ava-silver merged 1 commit into
masterfrom
ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation
Jun 25, 2026
Merged

[SVLS-9256] auto-mark dd env sticky on slot instrumentation#2340
ava-silver merged 1 commit into
masterfrom
ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation

Conversation

@ava-silver

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

Copy link
Copy Markdown
Contributor

What and why?

In Azure App Service, a slot swap swaps app settings between slots by default. DD_ENV should be a sticky slot setting so a slot keeps its own environment tag after a swap, instead of the production slot's DD_ENV bleeding into staging.

This makes aas instrument register DD_ENV as a sticky slot setting whenever a slot is instrumented with --env. Non-slot instrumentation is unaffected.

How?

  • common.ts:
    • StickySlotSettings describes the sticky names a site needs (resourceGroup, webAppName, names).
    • aggregateStickyBySite collapses the per-resource sticky settings reported during instrumentation into one entry per site, unioning their names. slotConfigNames is a single site-level resource shared by all of a site's slots, so it keys by web app name (App Service names are globally unique) and writes each site once -- avoiding the concurrent read-modify-writes (and Azure 409s) that would happen if multiple slots of the same app each wrote it.
    • registerStickySlotSettings performs that single read-modify-write, appending any missing names via updateSlotConfigurationNames. It no-ops when the names are already sticky, logs the action, and honors dry-run.
  • instrument.ts:
    • processWebApp now returns a ProcessResult ({success, sticky?}) instead of a bare boolean, reporting the sticky settings the resource needs on its parent site (just DD_ENV, and only for slots with --env).
    • processSubscription aggregates those results and registers the sticky settings once per site after all resources are processed.

Review checklist

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

ava-silver commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Jun 5, 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: cb356f8 | Docs | Datadog PR Page | Give us feedback!

@ava-silver ava-silver added enhancement New feature or request serverless Related to [aas, cloud-run, lambda, stepfunctions] labels Jun 5, 2026
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch from 34ec27c to bab86f4 Compare June 12, 2026 20:21
@ava-silver
ava-silver marked this pull request as ready for review June 12, 2026 20:23
@ava-silver
ava-silver requested review from a team as code owners June 12, 2026 20:23
@ava-silver
ava-silver requested a review from avangelillo June 12, 2026 20:23
Comment on lines +173 to +174
this.instrumentSidecar(aasClient, config, resourceGroup, webApp, isContainer, existingEnvVars),
this.makeStickySlotEnvVars(aasClient, resourceGroup, webApp, config),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will we ever want to instrument a web app and not make the slot env vars sticky? Is it worth moving this into instrumentSidecar / instrumentExtension

@ava-silver ava-silver Jun 22, 2026

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.

No, but also the current functions of instrumentSidecar/instrumentExtension are for conceptually splitting out the logic needed to update the config/extension, rather than for splitting out the entire instrumentation process. we currently also have this same pattern for updating tags, so I'm inclined to say its fine here, especially since it makes parallelization much easier than putting the calls into the instrument* bodies

@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch 2 times, most recently from ea23e68 to 7556a51 Compare June 22, 2026 18:22
@ava-silver
ava-silver requested a review from avangelillo June 22, 2026 18:24
@ava-silver
ava-silver force-pushed the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch 4 times, most recently 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 merged commit 63e9423 into master Jun 25, 2026
34 checks passed
@ava-silver
ava-silver deleted the ava.silver/svls-9256/auto-mark-dd-env-sticky-on-slot-instrumentation branch June 25, 2026 17:18
@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

enhancement New feature or request serverless Related to [aas, cloud-run, lambda, stepfunctions]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants