Skip to content

Commit

Permalink
chore: update polling for Cloud Run sample (#3231)
Browse files Browse the repository at this point in the history
* chore: update polling for Cloud Run sample

* update debug statementsg

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* debug

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com>
  • Loading branch information
3 people authored May 25, 2023
1 parent d303250 commit d5e7a97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit d5e7a97

Please sign in to comment.