Skip to content

Commit 75b96f4

Browse files
committed
Update Traffic Generator to remove canary type logic
1 parent 827ac08 commit 75b96f4

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

sample-apps/traffic-generator/index.js

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
2424

2525
// This loop will run until the environment variables are available
2626
const waitForEnvVariables = async () => {
27-
while (!process.env.MAIN_ENDPOINT || !process.env.REMOTE_ENDPOINT || !process.env.ID || !process.env.CANARY_TYPE) {
27+
while (!process.env.MAIN_ENDPOINT || !process.env.REMOTE_ENDPOINT || !process.env.ID) {
2828
console.log('Environment variables not set. Waiting for 10 seconds...');
2929
await sleep(10000); // Wait for 10 seconds
3030
}
@@ -37,33 +37,15 @@ const trafficGenerator = async (interval) => {
3737
const mainEndpoint = process.env.MAIN_ENDPOINT;
3838
const remoteEndpoint = process.env.REMOTE_ENDPOINT;
3939
const id = process.env.ID;
40-
const canaryType = process.env.CANARY_TYPE
4140

4241
let urls = [
4342
`http://${mainEndpoint}/outgoing-http-call`,
4443
`http://${mainEndpoint}/aws-sdk-call?ip=${remoteEndpoint}&testingId=${id}`,
4544
`http://${mainEndpoint}/remote-service?ip=${remoteEndpoint}&testingId=${id}`,
46-
`http://${mainEndpoint}/client-call`
45+
`http://${mainEndpoint}/client-call`,
46+
`http://${mainEndpoint}/mysql`,
4747
];
4848

49-
if (canaryType === 'java-eks' || canaryType === 'python-eks') {
50-
urls.push(`http://${mainEndpoint}/mysql`)
51-
}
52-
53-
// Need to call some APIs so that it exceeds the metric limiter threshold and make the test
54-
// APIs generate AllOtherOperations metric. Sleep for a minute to let cloudwatch service process the API call
55-
// Calling it here before calling the remote sample app endpoint because the API generated by it is validated
56-
// for AllOtherRemoteOperations in the metric validation step
57-
if (canaryType === 'java-metric-limiter'){
58-
const fakeUrls = [
59-
`http://${mainEndpoint}`,
60-
`http://${mainEndpoint}/fake-endpoint`
61-
]
62-
// Send the fake requests and wait a minute
63-
await sendRequests(fakeUrls);
64-
await sleep(60000);
65-
}
66-
6749
await sendRequests(urls);
6850
setInterval(() => sendRequests(urls), interval);
6951
}

0 commit comments

Comments
 (0)