Skip to content

Commit 80cc318

Browse files
authored
chore: updates nodejs and ts samples to incorporate execution id (#75)
Updates nodejs and ts samples to incorporate execution id
1 parent 73c72da commit 80cc318

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

samples/generic-synthetic-nodejs/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const functions = require('@google-cloud/functions-framework');
2020
const axios = require('axios');
2121
const assert = require('node:assert');
2222

23-
functions.http('SyntheticFunction', runSyntheticHandler(async ({logger}) => {
23+
functions.http('SyntheticFunction', runSyntheticHandler(async ({logger, executionId}) => {
2424
/*
2525
* This function executes the synthetic code for testing purposes.
2626
* If the code runs without errors, the synthetic test is considered successful.
2727
* If an error is thrown during execution, the synthetic test is considered failed.
2828
*/
29-
logger.info('Making an http request using synthetics');
29+
logger.info('Making an http request using synthetics, with execution id: ' + executionId);
3030
const url = 'https://www.google.com/'; // URL to send the request to
3131
return await assert.doesNotReject(axios.get(url));
3232
}));

samples/generic-synthetic-nodejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"dependencies": {
77
"@google-cloud/functions-framework": "^3.1.2",
8-
"@google-cloud/synthetics-sdk-api": "^0.3.0",
8+
"@google-cloud/synthetics-sdk-api": "^0.4.1",
99
"axios": "^1.5.0"
1010
},
1111
"license": "Apache-2.0",

samples/generic-synthetic-typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"author": "Google Inc.",
1515
"dependencies": {
1616
"@google-cloud/functions-framework": "^3.2.0",
17-
"@google-cloud/synthetics-sdk-api": "^0.3.0",
17+
"@google-cloud/synthetics-sdk-api": "^0.4.1",
1818
"axios": "^1.5.0",
1919
"winston": "^3.10.0"
2020
},

samples/generic-synthetic-typescript/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import axios from 'axios';
2121
import assert from 'node:assert';
2222
import {Logger} from 'winston';
2323

24-
ff.http('SyntheticFunction', runSyntheticHandler(async ({logger}: {logger: Logger}) => {
24+
ff.http('SyntheticFunction', runSyntheticHandler(async ({logger, executionId}: {logger: Logger, executionId: string|undefined}) => {
2525
/*
2626
* This function executes the synthetic code for testing purposes.
2727
* If the code runs without errors, the synthetic test is considered successful.
2828
* If an error is thrown during execution, the synthetic test is considered failed.
2929
*/
30-
logger.info('Making an http request using synthetics');
30+
logger.info('Making an http request using synthetics, with execution id: ' + executionId);
3131
const url = 'https://www.google.com/'; // URL to send the request to
3232
return await assert.doesNotReject(axios.get(url));
3333
}));

0 commit comments

Comments
 (0)