Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update polling for Cloud Run sample #3231

Merged
merged 8 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion run/logging-manual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 0",
"system-test": "c8 mocha test/system.test.js --timeout=600000 --exit"
"system-test": "c8 mocha test/system.test.js --timeout=800000 --exit"
},
"author": "",
"license": "Apache-2.0",
Expand Down
7 changes: 6 additions & 1 deletion run/logging-manual/test/system.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,19 @@ describe('Logging', () => {
let attempt = 0;
const maxAttempts = 10;
while ((!requestLog || !sampleLog) && attempt < maxAttempts) {
await sleep(attempt * 30000); // Linear backoff between retry attempts
console.log(`Polling for logs: attempt #${attempt + 1}`);
await sleep(attempt * 10000); // Linear backoff between retry attempts
// Filter by service name over the last 5 minutes
const filter = `resource.labels.service_name="${service_name}" timestamp>="${dateMinutesAgo(
new Date(),
5
)}"`;
entries = await getLogEntriesPolling(filter);
console.log(
`Found ${entries.length} log entries using filter: ${filter}`
);
entries.forEach(entry => {
console.debug(entry);
if (entry.metadata.httpRequest) {
requestLog = entry;
} else {
Expand Down