From 678fda9001e919442d4e438699300e748673bb6a Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 11 Jun 2024 12:16:33 -0500 Subject: [PATCH] CLDR-17699 DataDog in Ansible (#3797) --- .github/workflows/maven.yml | 7 +++++++ .github/workflows/production.yml | 5 +++++ tools/scripts/ansible/hosts | 8 +++++++ tools/scripts/ansible/monitoring-playbook.yml | 21 +++++++++++++------ tools/scripts/ansible/requirements.yml | 2 +- .../ansible/templates/bootstrap-properties.j2 | 9 ++++++++ 6 files changed, 45 insertions(+), 7 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c9e61af4087..e8940d0622b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -90,6 +90,13 @@ jobs: -DskipTests=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: DataDog sourcemap upload + # only on push to main! + if: github.repository == 'unicode-org/cldr' && github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.inputs.git-ref == '' + run: npx --package=@datadog/datadog-ci datadog-ci sourcemaps upload tools/cldr-apps/src/main/webapp/dist/ --minified-path-prefix=/cldr-apps/dist/ --release-version=r${{ github.event.inputs.git-ref }} --service=surveytool + env: + DATADOG_SITE: ${{ secrets.DATADOG_SITE }} + DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} - name: Checkout CLDR archive run: > mkdir -v ../cldr-archive && java -jar tools/cldr-code/target/cldr-code.jar checkout-archive diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 9c7c543d5f4..1efb27c7902 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -52,6 +52,11 @@ jobs: -DskipTests=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: DataDog sourcemap upload + run: npx --package=@datadog/datadog-ci datadog-ci sourcemaps upload tools/cldr-apps/src/main/webapp/dist/ --minified-path-prefix=/cldr-apps/dist/ --release-version=r${{ github.event.inputs.git-ref }} --service=surveytool + env: + DATADOG_SITE: ${{ secrets.DATADOG_SITE }} + DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} - name: Build liberty server run: > mvn -s .github/workflows/mvn-settings.xml -B -pl cldr-apps liberty:create liberty:deploy liberty:package -Dinclude=usr --file tools/pom.xml diff --git a/tools/scripts/ansible/hosts b/tools/scripts/ansible/hosts index 37716728047..4d71e99ad88 100644 --- a/tools/scripts/ansible/hosts +++ b/tools/scripts/ansible/hosts @@ -2,9 +2,17 @@ cldr-smoke.unicode.org cldr-staging.unicode.org +[staging:vars] +# dd_env is the DataDog environment, staging vs prod +dd_env=staging + [prod] st.unicode.org +[prod:vars] +# dd_env is the DataDog environment, staging vs prod +dd_env=prod + # CLDR Commit Checker web hosting here [ccc] cldr-smoke.unicode.org diff --git a/tools/scripts/ansible/monitoring-playbook.yml b/tools/scripts/ansible/monitoring-playbook.yml index 8b6b4e3cc9b..66cafc36889 100644 --- a/tools/scripts/ansible/monitoring-playbook.yml +++ b/tools/scripts/ansible/monitoring-playbook.yml @@ -1,14 +1,23 @@ -- hosts: cldr-staging.unicode.org +- hosts: + - cldr-staging.unicode.org + - st.unicode.org become: yes vars_files: - vars/main.yml - local-vars/local.yml - tasks: - - name: Import the Datadog Agent role from the Datadog collection - import_role: - name: datadog.dd.agent + roles: + - { role: datadog.datadog, become: yes } vars: datadog_api_key: "{{ dd_key }}" datadog_site: "{{ dd_site }}" datadog_apm_instrumentation_enabled: "host" # docker not installed else 'all' - + tasks: + - name: Update datadog.yaml for apm/env + blockinfile: + path: /etc/datadog-agent/datadog.yaml + block: | + # enable apm and set the env + enabled: true + env: {{ dd_env }} + marker: '# {mark} ANSIBLE MANAGED BLOCK' + insertafter: '^apm_config:' diff --git a/tools/scripts/ansible/requirements.yml b/tools/scripts/ansible/requirements.yml index db9986ff744..d7377c6b0cf 100644 --- a/tools/scripts/ansible/requirements.yml +++ b/tools/scripts/ansible/requirements.yml @@ -5,7 +5,7 @@ - src: derjd.journald version: 0.0.1 - src: DataDog.datadog - version: 4.20.1 + version: 4.21.0 # - src: https://github.com/Naillik13/ansible-role-mysql # version: diff --git a/tools/scripts/ansible/templates/bootstrap-properties.j2 b/tools/scripts/ansible/templates/bootstrap-properties.j2 index 575ebd13eb2..6a54c4a0c8c 100644 --- a/tools/scripts/ansible/templates/bootstrap-properties.j2 +++ b/tools/scripts/ansible/templates/bootstrap-properties.j2 @@ -5,3 +5,12 @@ # the full path to the config dir. # It requires a code update in CLDRConfigImpl. org.unicode.cldr.util.CLDRConfigImpl.cldrHome="{{ cldr_path }}" + +# datadog things +dd.dynamic.instrumentation.enabled=true +dd.logs.injection=true +dd.env={{ dd_env }} + +# for DD: use json! +com.ibm.ws.logging.message.format=json +com.ibm.ws.logging.message.source=message,trace,accessLog,ffdc,audit