From a955b5a213252c3260a2f2c42145a7ccf64e666b Mon Sep 17 00:00:00 2001 From: dschom Date: Tue, 18 Oct 2022 17:04:04 -0700 Subject: [PATCH] task(ci): Enable tracing in CI Because: - We want to exercise tracing code paths in CI to spot potential errors This Commit: - Configures CI to turn basic tracing - Configures a sample rate of 0, so as not execute code paths but not output traces - Fixes a bug found in the suppress tracing code in fxa shared. Not all arguments were getting propagated. --- .circleci/config.yml | 9 +++++++++ .circleci/test-package.sh | 4 ++++ packages/fxa-auth-server/lib/routes/index.js | 6 +++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ec8dc5e762..498dd3b82c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,8 @@ executors: FXA_EMAIL_LOG_LEVEL: debug RUST_BACKTRACE: 1 AUTH_FIRESTORE_EMULATOR_HOST: localhost:9090 + TRACING_SERVICE_NAME: ci-content-server-executor + TRACING_CONSOLE_EXPORTER_ENABLED: true environment: FXA_MX_RECORD_EXCLUSIONS: restmail.dev.lcip.org @@ -103,6 +105,8 @@ jobs: environment: NODE_ENV: dev FIRESTORE_EMULATOR_HOST: localhost:9090 + TRACING_SERVICE_NAME: ci-test-package + TRACING_CONSOLE_EXPORTER_ENABLED: true parameters: package: type: string @@ -126,6 +130,9 @@ jobs: - image: jdlk7/firestore-emulator - image: memcached - image: redis + environment: + TRACING_SERVICE_NAME: ci-test-many + TRACING_CONSOLE_EXPORTER_ENABLED: true steps: - base-install - run: @@ -268,6 +275,8 @@ jobs: - image: jdlk7/firestore-emulator environment: NODE_ENV: dev + TRACING_SERVICE_NAME: ci-playwright-functional-tests + TRACING_CONSOLE_EXPORTER_ENABLED: true steps: # needed by check-mysql.sh - run: apt-get update && apt-get install -y netcat diff --git a/.circleci/test-package.sh b/.circleci/test-package.sh index eb12984b6a..9dcc0ee870 100755 --- a/.circleci/test-package.sh +++ b/.circleci/test-package.sh @@ -8,6 +8,10 @@ if grep -e "$MODULE" -e 'all' "$DIR/../packages/test.list" > /dev/null; then echo -e "\n###################################" echo "# testing $MODULE" echo -e "###################################\n" + + echo -e "TRACING_SERVICE_NAME=$TRACING_SERVICE_NAME" + echo -e "TRACING_CONSOLE_EXPORTER_ENABLED=$TRACING_CONSOLE_EXPORTER_ENABLED" + if [[ -x scripts/test-ci.sh ]]; then time ./scripts/test-ci.sh else diff --git a/packages/fxa-auth-server/lib/routes/index.js b/packages/fxa-auth-server/lib/routes/index.js index 2458b434a5..82c2829525 100644 --- a/packages/fxa-auth-server/lib/routes/index.js +++ b/packages/fxa-auth-server/lib/routes/index.js @@ -203,7 +203,7 @@ module.exports = function ( ); function optionallyIgnoreTrace(fn) { - return async function (request) { + return async function (request, ...args) { // Only authenticated routes or routes that specify an uid/email // can be traced because those routes can look a user up const canOptOut = @@ -219,11 +219,11 @@ module.exports = function ( // will get this. return tracing.suppressTrace(() => { - return fn(request); + return fn(request, ...args); }); } } - return fn(request); + return fn(request, ...args); }; }