From accf33f024d344235bbcdefe31a412bf658f1b6d Mon Sep 17 00:00:00 2001 From: harryryu Date: Mon, 29 Jul 2024 17:51:12 -0700 Subject: [PATCH] Update Traffic Generator to remove canary type logic --- .../traffic-generator-image-build.yml | 8 +++---- sample-apps/traffic-generator/index.js | 21 +------------------ 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/.github/workflows/traffic-generator-image-build.yml b/.github/workflows/traffic-generator-image-build.yml index ad8808050..bc8da8560 100644 --- a/.github/workflows/traffic-generator-image-build.yml +++ b/.github/workflows/traffic-generator-image-build.yml @@ -5,10 +5,10 @@ name: Create and Push Traffic Generator on: workflow_dispatch: push: - branches: - - main - paths: - - 'sample-apps/traffic-generator/**' +# branches: +# - main +# paths: +# - 'sample-apps/traffic-generator/**' permissions: id-token: write diff --git a/sample-apps/traffic-generator/index.js b/sample-apps/traffic-generator/index.js index 5cc2c7bd4..263bbc444 100644 --- a/sample-apps/traffic-generator/index.js +++ b/sample-apps/traffic-generator/index.js @@ -24,7 +24,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); // This loop will run until the environment variables are available const waitForEnvVariables = async () => { - while (!process.env.MAIN_ENDPOINT || !process.env.REMOTE_ENDPOINT || !process.env.ID || !process.env.CANARY_TYPE) { + while (!process.env.MAIN_ENDPOINT || !process.env.REMOTE_ENDPOINT || !process.env.ID) { console.log('Environment variables not set. Waiting for 10 seconds...'); await sleep(10000); // Wait for 10 seconds } @@ -37,7 +37,6 @@ const trafficGenerator = async (interval) => { const mainEndpoint = process.env.MAIN_ENDPOINT; const remoteEndpoint = process.env.REMOTE_ENDPOINT; const id = process.env.ID; - const canaryType = process.env.CANARY_TYPE let urls = [ `http://${mainEndpoint}/outgoing-http-call`, @@ -46,24 +45,6 @@ const trafficGenerator = async (interval) => { `http://${mainEndpoint}/client-call` ]; - if (canaryType === 'java-eks' || canaryType === 'python-eks') { - urls.push(`http://${mainEndpoint}/mysql`) - } - - // Need to call some APIs so that it exceeds the metric limiter threshold and make the test - // APIs generate AllOtherOperations metric. Sleep for a minute to let cloudwatch service process the API call - // Calling it here before calling the remote sample app endpoint because the API generated by it is validated - // for AllOtherRemoteOperations in the metric validation step - if (canaryType === 'java-metric-limiter'){ - const fakeUrls = [ - `http://${mainEndpoint}`, - `http://${mainEndpoint}/fake-endpoint` - ] - // Send the fake requests and wait a minute - await sendRequests(fakeUrls); - await sleep(60000); - } - await sendRequests(urls); setInterval(() => sendRequests(urls), interval); }