Skip to content

feat(supabase): add tracing integration #20540

feat(supabase): add tracing integration

feat(supabase): add tracing integration #20540

name: Test Optimization
on:
pull_request:
push:
branches: [master, mq-working-branch-master-*]
schedule:
- cron: 0 4 * * *
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.ref }}
cancel-in-progress: true
env:
# TODO: remove this once we have stable tests
MOCHA_OPTIONS: --retries 2
jobs:
benchmarks-e2e:
name: Performance and correctness tests
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
id: octo-sts
with:
scope: DataDog/test-environment
policy: dd-trace-js
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ steps.octo-sts.outputs.token }}
- uses: ./.github/actions/node/oldest-maintenance-lts
- name: Test Optimization Performance Overhead Test
run: npm run bench:e2e:test-optimization
env:
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}
TEST_ENVIRONMENT_REF_TO_TEST: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
TEST_ENVIRONMENT_REF_NAME: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
integration:
strategy:
fail-fast: false
matrix:
version: [oldest, maintenance, active, latest]
name: ${{ github.workflow }} / integration (node-${{ matrix.version }})
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- name: Get Playwright version from versions package.json
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(node -p \
"const versions = require('./integration-tests/playwright/versions'); \
versions.getLatestPlaywrightSpecifier() === 'latest' \
? versions.latest \
: versions.latestSupportedByNode18")
echo "version=$PLAYWRIGHT_VERSION" >> "$GITHUB_OUTPUT"
echo "Playwright version: $PLAYWRIGHT_VERSION"
- name: Cache Playwright browsers
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- run: npm run test:integration:testopt:coverage
- uses: ./.github/actions/coverage
with:
flags: test-optimization-testopt-${{ matrix.version }}
playwright-image:
strategy:
fail-fast: false
matrix:
playwright-version: [oldest, latest, latest-node18]
name: Ensure Playwright Docker image (${{ matrix.playwright-version }})
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
# All matrix jobs set this to the same value, so the last-writer-wins
# behaviour of matrix outputs is safe here.
images: ${{ steps.versions.outputs.images }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Determine versions
id: versions
run: |
LATEST=$(node -p "require('./integration-tests/playwright/versions').latest")
LATEST_NODE18=$(node -p "require('./integration-tests/playwright/versions').latestSupportedByNode18")
OLDEST=$(node -p "require('./integration-tests/playwright/versions').oldest")
DOCKER_HASH=$(sha256sum .github/playwright/Dockerfile | cut -c1-8)
LATEST_TAG="${LATEST}-${DOCKER_HASH}"
LATEST_NODE18_TAG="${LATEST_NODE18}-${DOCKER_HASH}"
OLDEST_TAG="${OLDEST}-${DOCKER_HASH}"
BASE="ghcr.io/datadog/dd-trace-js/playwright-tools"
IMAGES=$(printf \
'{"latest":{"latest":"%s:%s","oldest":"%s:%s"},"oldest":{"latest":"%s:%s","oldest":"%s:%s"}}' \
"$BASE" "$LATEST_TAG" "$BASE" "$OLDEST_TAG" "$BASE" "$LATEST_NODE18_TAG" "$BASE" "$OLDEST_TAG")
case "${{ matrix.playwright-version }}" in
latest)
PW_VERSION="$LATEST"
IMAGE_TAG="$LATEST_TAG"
;;
latest-node18)
PW_VERSION="$LATEST_NODE18"
IMAGE_TAG="$LATEST_NODE18_TAG"
;;
*)
PW_VERSION="$OLDEST"
IMAGE_TAG="$OLDEST_TAG"
;;
esac
{
echo "images=$IMAGES"
echo "pw-version=$PW_VERSION"
echo "image-tag=$IMAGE_TAG"
} >> "$GITHUB_OUTPUT"
- name: Log in to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure image
env:
PW_VERSION: ${{ steps.versions.outputs.pw-version }}
IMAGE_TAG: ${{ steps.versions.outputs.image-tag }}
run: |
IMAGE="ghcr.io/datadog/dd-trace-js/playwright-tools:${IMAGE_TAG}"
if docker manifest inspect "${IMAGE}" > /dev/null 2>&1; then
echo "Image ${IMAGE} already exists, skipping build"
else
docker build --build-arg PLAYWRIGHT_VERSION="${PW_VERSION}" \
-t "${IMAGE}" .github/playwright
docker push "${IMAGE}"
fi
integration-playwright:
needs: playwright-image
strategy:
fail-fast: false
matrix:
node-version: [oldest, latest]
playwright-version: [oldest, latest]
spec:
- playwright-reporting
- playwright-efd
- playwright-atr
- playwright-test-management
- playwright-active-test-span
- playwright-impacted-tests
- playwright-final-status
name: integration-playwright (${{ matrix.playwright-version}}, node-${{ matrix.node-version }}, ${{ matrix.spec }})
runs-on: ubuntu-latest
permissions:
id-token: write
container:
image: ${{ fromJson(needs.playwright-image.outputs.images)[matrix.node-version][matrix.playwright-version] }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
OPTIONS_OVERRIDE: 1
PLAYWRIGHT_VERSION: ${{ matrix.playwright-version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.node-version }}
- uses: ./.github/actions/install
- name: Configure Git safe directory
# The Playwright job runs in a container where the checkout can be owned by a different UID.
# Git rejects metadata commands in that checkout unless the workspace is marked as safe.
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: npm run test:integration:playwright:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
SPEC: ${{ matrix.spec }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-playwright-${{ matrix.node-version }}-${{ matrix.playwright-version }}-${{ matrix.spec }}
integration-mocha:
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
# "oldest" is 5.2.0 in <=5 and 8.0.0 in >=6
mocha-version: [oldest, latest]
runs-on: ubuntu-latest
permissions:
id-token: write
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: npm run test:integration:mocha:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
MOCHA_VERSION: ${{ matrix.mocha-version }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-mocha-${{ matrix.version }}-${{ matrix.mocha-version }}
integration-webdriverio:
strategy:
fail-fast: false
matrix:
include:
- node-version: oldest
webdriverio-version: oldest
- node-version: latest
webdriverio-version: latest
name: integration-webdriverio (${{ matrix.webdriverio-version }}, node-${{ matrix.node-version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/node
with:
version: ${{ matrix.node-version }}
- uses: ./.github/actions/install
- run: npm run test:instrumentations:ci
env:
PLUGINS: webdriverio
- run: npm run test:integration:webdriverio:coverage
env:
WEBDRIVERIO_VERSION: ${{ matrix.webdriverio-version }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-webdriverio-${{ matrix.node-version }}-${{ matrix.webdriverio-version }}
integration-jest:
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
# "oldest" is 24.8.0 in <=5 and 28.0.0 in >=6
jest-version: [oldest, latest]
spec:
- jest.core
- jest.tia-efd
- jest.test-management
test-pattern:
- ''
include:
- version: oldest
jest-version: 25.5.1
spec: jest.tia-efd
test-pattern: '^jest@25[.]5[.]1 commonJS early flake detection retries new tests$'
name: integration-jest (${{ matrix.jest-version }}, node-${{ matrix.version }}, ${{ matrix.spec }})
runs-on: ubuntu-latest
permissions:
id-token: write
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- name: Simulate the v5 release line for Jest 25 compatibility
if: matrix.jest-version == '25.5.1'
run: npm pkg set version=5.0.0
- run: npm run test:integration:jest:coverage -- --grep "$JEST_TEST_PATTERN"
env:
NODE_OPTIONS: "-r ./ci/init"
JEST_VERSION: ${{ matrix.jest-version }}
JEST_TEST_PATTERN: ${{ matrix.test-pattern }}
SPEC: ${{ matrix.spec }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-jest-${{ matrix.version }}-${{ matrix.jest-version }}
dependency-helpers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/node
- uses: ./.github/actions/install
- run: npm run test:integration:test-optimization:helpers
integration-cucumber:
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
cucumber-version: [7.0.0, latest]
runs-on: ubuntu-latest
permissions:
id-token: write
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: npm run test:integration:cucumber:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
CUCUMBER_VERSION: ${{ matrix.cucumber-version }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-cucumber-${{ matrix.version }}-${{ matrix.cucumber-version }}
selenium-image:
name: Ensure Selenium Docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
image: ${{ steps.image.outputs.image }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Determine image tag
id: image
run: |
DOCKER_HASH=$(sha256sum .github/selenium/Dockerfile | cut -c1-8)
IMAGE="ghcr.io/datadog/dd-trace-js/selenium-tools:${DOCKER_HASH}"
echo "image=$IMAGE" >> "$GITHUB_OUTPUT"
- name: Log in to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Ensure image
env:
IMAGE: ${{ steps.image.outputs.image }}
run: |
if docker manifest inspect "${IMAGE}" > /dev/null 2>&1; then
echo "Image ${IMAGE} already exists, skipping build"
else
docker build -t "${IMAGE}" .github/selenium
docker push "${IMAGE}"
fi
integration-selenium:
needs: selenium-image
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
runs-on: ubuntu-latest
permissions:
id-token: write
container:
image: ${{ needs.selenium-image.outputs.image }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
OPTIONS_OVERRIDE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- name: Configure Git safe directory
# The Selenium job runs in a container where the checkout can be owned by a different UID.
# Git rejects metadata commands in that checkout unless the workspace is marked as safe.
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: npm run test:integration:selenium:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-selenium-${{ matrix.version }}
integration-cypress:
strategy:
fail-fast: false
matrix:
version: [eol, oldest, latest]
# 6.7.0 is the minimum version we support in <=5
# 12.0.0 is the minimum version we support in >=6
# 14.5.4 is the latest version that supports Node 18
# The logic to decide whether the tests run lives in the individual spec files
cypress-version: [6.7.0, 12.0.0, 14.5.4, latest]
module-type: ["commonJS", "esm"]
spec:
- cypress-reporting
- cypress-reporting-instrumentation
- cypress-itr
- cypress-tia-code-coverage
- cypress-efd
- cypress-atr
- cypress-test-management
- cypress-final-status-impacted-tests
exclude:
# 6.7.0 only runs on DD_MAJOR <= 5 with Node 16/commonJS.
# On DD_MAJOR >= 6, shouldTestsRun() skips this remaining matrix entry.
- cypress-version: 6.7.0
module-type: esm
- version: oldest
cypress-version: 6.7.0
- version: latest
cypress-version: 6.7.0
# eol = Node 16 only runs Cypress 6.7.0 for DD_MAJOR <= 5
- version: eol
cypress-version: 12.0.0
- version: eol
cypress-version: 14.5.4
- version: eol
cypress-version: latest
# Node 18 (oldest) only supports 12.0.0 and 14.5.4, not latest
- version: oldest
cypress-version: latest
name: integration-cypress (${{ matrix.cypress-version }}, node-${{ matrix.version }}, ${{ matrix.module-type }}, ${{ matrix.spec }})
runs-on: ubuntu-latest
permissions:
id-token: write
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- name: Resolve Cypress version
id: cypress-version
run: |
if [ "${{ matrix.cypress-version }}" = "latest" ]; then
RESOLVED=$(node -p "require('./packages/dd-trace/test/plugins/versions/package.json').dependencies.cypress")
else
RESOLVED="${{ matrix.cypress-version }}"
fi
echo "resolved=$RESOLVED" >> "$GITHUB_OUTPUT"
- name: Cache Cypress binary
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/Cypress
key: cypress-binary-${{ steps.cypress-version.outputs.resolved }}
- run: yarn config set ignore-engines true
- run: npm run test:integration:cypress:coverage
env:
CYPRESS_VERSION: ${{ matrix.cypress-version }}
NODE_OPTIONS: "-r ./ci/init"
CYPRESS_MODULE_TYPE: ${{ matrix.module-type }}
OPTIONS_OVERRIDE: 1
SPEC: ${{ matrix.spec }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-cypress-${{ matrix.version }}-${{ matrix.cypress-version }}-${{ matrix.module-type }}
integration-vitest:
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
spec:
- vitest.core
- vitest.tia
- vitest.test-management
- vitest.advanced
- vitest.msw
- vitest.no-worker-init
name: integration-vitest (node-${{ matrix.version }}, ${{ matrix.spec }})
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
OPTIONS_OVERRIDE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- run: npm run test:integration:vitest:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
SPEC: ${{ matrix.spec }}
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
- uses: ./.github/actions/coverage
with:
flags: test-optimization-vitest-${{ matrix.version }}
integration-vitest-browser:
needs: playwright-image
runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
version: [oldest, latest]
name: integration-vitest-browser (node-${{ matrix.version }})
container:
image: ${{ fromJson(needs.playwright-image.outputs.images)[matrix.version].latest }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
DD_SERVICE: dd-trace-js-integration-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
OPTIONS_OVERRIDE: 1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/dd-sts-api-key
id: dd-sts
continue-on-error: true
- uses: ./.github/actions/node
with:
version: ${{ matrix.version }}
- uses: ./.github/actions/install
- name: Configure Git safe directory
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: npm run test:instrumentations
env:
PLUGINS: vitest-main
- run: npm run test:integration:vitest:coverage
env:
NODE_OPTIONS: "-r ./ci/init"
DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }}
SPEC: vitest.browser
- uses: ./.github/actions/coverage
with:
flags: test-optimization-vitest-browser-${{ matrix.version }}