Enhance DataDog Synthetics Monitoring Automation - #235
Open
cawohnjing wants to merge 29 commits into
Open
Conversation
… log request/assertions before send
… duplicated logic across multiple files
Comment on lines
+15
to
+58
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.9 | ||
| id: python-setup | ||
| uses: actions/setup-python@b64ffcaf5b410884ad320a9cfac8866006a109aa # v4.8.0 | ||
| with: | ||
| python-version: "3.9" | ||
|
|
||
| - name: Install Dependencies | ||
| id: install-dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r monitoring/scripts/datadog/requirements.txt | ||
|
|
||
| - name: Run the monitor update script | ||
| id: monitor-update | ||
| env: | ||
| DD_API_KEY: ${{ secrets.DD_API_KEY }} | ||
| DD_APP_KEY: ${{ secrets.DD_APP_KEY }} | ||
| DD_ALERT_EMAIL: ${{ secrets.EMAIL }} | ||
| DD_PRIVATE_LOCATION_ID: aws:us-gov-west-1 | ||
| DD_SITE: "ddog-gov.com" | ||
| run: | | ||
| CSV_FILE="https://raw.githubusercontent.com/CBIIT/datacommons-devops/main/monitoring/FNL-Monitoring-List.csv" | ||
|
|
||
| if [ -n "${{ github.event.inputs.csv_file }}" ]; then | ||
| CSV_FILE="${{ github.event.inputs.csv_file }}" | ||
| fi | ||
|
|
||
| python3 -u monitoring/scripts/datadog/monitor_update_csv.py -f "$CSV_FILE" | ||
|
|
||
| - name: Slack Notification | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| uses: act10ns/slack@87c73aef9f8838eb6feae81589a6b1487a4a9e08 # v1.6.0 | ||
| with: | ||
| status: ${{ job.status }} | ||
| steps: ${{ toJson(steps) }} | ||
| message: "Datadog Monitors Updated" | ||
| if: always() |
michael-fleming-nih
requested changes
Jul 28, 2026
michael-fleming-nih
left a comment
Contributor
There was a problem hiding this comment.
these changes look good for the datadog scripts, please duplicate the csv file for this so the newrelic pipeline is not impacted
Contributor
There was a problem hiding this comment.
can we duplicate this file to be datadog specific? we will want the existing newrelic scripts to still be able to run, we just want to add in datadog scripts
Collaborator
Author
There was a problem hiding this comment.
Sure, Let me do that and push the changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates DataDog Synthetics monitor generation to reflect what each endpoint's original New Relic script actually tested, replacing generic/placeholder checks, and adds a new dedicated workflow file for DataDog.
Changes
Workflow
.github/workflows/update-monitoring-datadog.yml: a dedicated DataDog automation (scheduled + manual dispatch with CSV override), configured for the GovCloud DataDog site (ddog-gov.com) with its own API/App key and private-location secrets.Monitor Routing (
monitor_update_csv.py)Validation_Textbut no script now route to a browser test instead of a raw HTTP body-contains check. A plain HTTP request can't see content rendered client-side by JavaScript, which was causing silent failures on JS-rendered pages.API Monitors (
set_api_multistep_monitor.py)POSTto the row's base URL, with a real parser that extracts the actual HTTP method, URL, and POST body from the script.javascriptassertion (via Chai'sdd.assert) instead of a hand-rolled, easily broken JSONPath translation.Browser Monitors (
set_browser_monitor.py)Browser_Queryscripts into a DataDogassertElementContentstep (URL, XPath, wait timeout).Validation_Textwhen no script exists.failTestOnCannotLocatefield and an XPath fix to prevent "multiple elements found" errors on pages with duplicate matching text.Shared Helpers
dd_client.pygainedtick_every,default_tags,build_alarm_message, andupsert_and_report.monitors/synthetics/script_parsing.pywith a sharedextract_balanced_braceshelper, removing logic previously duplicated across all four monitor-builder modules.Data
Slack_Channelvalues to use channel names instead of channel IDs, matching how DataDog's Slack integration resolves@slack-<channel>mentions.