Skip to content

Datadog: publish helpline account and Studio flow SIDs to the Reference Tables - #4848

Open
janorivera wants to merge 15 commits into
masterfrom
alejandro-c/datadog_helpline_tags
Open

janorivera wants to merge 15 commits into
masterfrom
alejandro-c/datadog_helpline_tags

Conversation

@janorivera

Copy link
Copy Markdown
Collaborator

Each configure apply now writes the helpline's Twilio account SID and Studio flow SIDs to S3 (aselo-datadog-reference-tables). The Datadog Reference Tables read those files, and the "Aselo helpline tags (reference tables)" pipeline uses them to tag Event Stream logs with account_short_code, account_env and flow_name. This replaces the old hand-maintained pipelines, which are now disabled.

Module: the datadog/v1 module writes two kinds of files:
Own files: each helpline environment's own files, at helpline-tags/{accounts,studio-flows}/_.csv.
Merged files: aselo_twilio_accounts.csv and aselo_twilio_studio_flows.csv, rebuilt on each apply from every helpline's files plus the seed.
On for every helpline, no flag: each helpline picks it up on its next configure apply. System-down flows aren't included yet.
Plan noise: a plan shows changes to the merged files when another helpline's rows have changed since this helpline's last apply.
Applies: don't run configure applies for two helplines at the same time.
prevent_destroy: the merged files have it because every helpline's state owns them. To decommission a helpline, delete its own files from S3.
Tested: applied to USNC staging and SG staging, and Datadog tagged their logs correctly. When an account or flow isn't in the tables, the logs get MISSING_ACCOUNT_SHORT_CODE, MISSING_ENV or MISSING_FLOW_NAME, and nothing is left untagged.

Rollout: Asana task 9a lists the helplines still to apply.

🤖 Generated with Claude Code

Alejandro Rivera and others added 11 commits November 9, 2026 17:02
…ables

New opt-in enable_datadog_tagging (default false, no change for helplines that
don't set it). When on, each configure apply writes the helpline's rows to
s3://aselo-datadog-reference-tables (us-east-1):
- helpline-tags/accounts/<code>_<env>.csv and helpline-tags/studio-flows/<code>_<env>.csv
- aselo_twilio_accounts.csv and aselo_twilio_studio_flows.csv, rebuilt from every
  helpline's files (plus seed files) with this helpline's rows on top

The Datadog Reference Tables aselo_twilio_accounts / aselo_twilio_studio_flows sync
from those files and a global pipeline tags Event Stream, ALB and Lambda logs with
account_short_code, account_env and flow_name. Replaces the hand-maintained lists in
the "Adding Account Tags" / "Studio Flows Sids to Labels" pipelines, which miss new
accounts and flows. Bucket, tables and pipeline are set up manually for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stent conditional result types')

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ted pending flow changes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aging test flag

- baseline/common.hcl: enable_datadog_tagging = true, so new helplines publish their account and
  Studio flow SIDs to the Datadog Reference Tables from their first configure apply
- as/staging.hcl: remove the enable_datadog_tagging test flag (the module stays off by default,
  existing helplines are unchanged)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tags)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e) and document the new fallback tags

- datadog/v1: rows in the merged and per-helpline CSV files are ordered by env, short code, then flow
  name (flows only), with the SID last to keep the sort keys unique
- datadog-debugger agent: MISSING_ACCOUNT_SHORT_CODE / MISSING_ENV / MISSING_FLOW_NAME are the
  fallback values of the Reference Table pipeline (old values before 2026-11-10)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the shared Reference Table files

- datadog/v1: every configure apply writes the helpline's account and Studio flow rows; there is no
  flag to turn it off (a flag set back to false would have deleted the shared merged files)
- merged files get prevent_destroy: no single helpline may delete them (decommissioning needs a
  removed block first)
- remove enable_datadog_tagging from the configure stage, baseline, USNC staging and SG staging
  (USNC/SG staging keep their rows: their resources stay in state with the same content)
- datadog-debugger agent: unmapped = configure not applied since tagging, or not in twilio-iac

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alejandro Rivera and others added 4 commits November 23, 2026 13:12
…ging, production)

Each configure apply writes its helpline's rows to aselo-datadog-reference-tables-<environment>, so
staging applies can no longer change production's files. Each bucket feeds its own two Datadog
Reference Tables (<table>_<dev|stg|prod>); one global pipeline looks SIDs up in all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng them

USNC and SG staging applied with the single shared bucket; moving to per-environment buckets would
replace their merged-file objects, and prevent_destroy fails that plan. Rename the resource and add a
removed block (destroy = false) so the old copies leave state untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… delay, seeds)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# folder / merged file / Reference Table per table:
# accounts accounts/ aselo_twilio_accounts.csv aselo_twilio_accounts
# studio_flows studio-flows/ aselo_twilio_studio_flows.csv aselo_twilio_studio_flows
# accounts accounts/ aselo_twilio_accounts.csv aselo_twilio_accounts_<dev|stg|prod>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we use full environment names rather than abbrecviated ones everywhere? It will save us having to map them in the future. Or is there a limit on the size of table names?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants