Skip to content

Commit be413ac

Browse files
authored
feat: update proto to support broken link screenshot support & add getExecutionRegion() functionality (#116)
* get-cloud-region (#100) Add functionality to synthetics-sdk-api to extract cloud region during GCF execution * stoage proto api (#101) * expose resolveProjectId (#104) * update to capture_condition (#109)
1 parent e4e56d7 commit be413ac

File tree

7 files changed

+639
-53
lines changed

7 files changed

+639
-53
lines changed

package-lock.json

Lines changed: 73 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/synthetics-sdk-api/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"error-stack-parser": "2.1.4",
4444
"google-auth-library": "9.0.0",
4545
"ts-proto": "1.148.1",
46-
"winston": "3.10.0"
46+
"winston": "3.10.0",
47+
"axios": "1.6.7"
4748
},
4849
"author": "Google Inc.",
4950
"license": "Apache-2.0"

packages/synthetics-sdk-api/proto/synthetic_response.proto

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ message TestResult {
5353

5454
// A list of StackFrame messages that indicate a single trace of code.
5555
repeated StackFrame stack_frames = 3;
56-
5756
// The raw stack trace associated with the error.
5857
string stack_trace = 4;
5958
}
@@ -88,7 +87,6 @@ message GenericResultV1 {
8887
// The full error message. Eg. "The url that you are fetching failed DNS
8988
// lookup".
9089
string error_message = 2;
91-
9290
// The name of the function where the error occurred.
9391
string function_name = 3;
9492
// The name of the file that reported the error.
@@ -132,6 +130,14 @@ message ResponseStatusCode {
132130
}
133131
}
134132

133+
// Information on an error that occurred.
134+
message BaseError {
135+
// The name of the error.
136+
string error_type = 1;
137+
// The full error message.
138+
string error_message = 2;
139+
}
140+
135141
// Aggregate and individual results of a Broken Link Synthetic execution
136142
message BrokenLinksResultV1 {
137143
// the total number of links checked as part of the execution
@@ -198,12 +204,31 @@ message BrokenLinksResultV1 {
198204
// the given specified link passed in "per_link_options" map.
199205
optional int64 link_timeout_millis = 2;
200206
}
207+
201208
// individual link options, default None. string must be formatted as a
202209
// fully qualified url
203210
map<string, PerLinkOption> per_link_options = 10;
204-
205211
// Timeout set for the entire Synthetic Monitor, default 60000 milliseconds
206212
optional int64 total_synthetic_timeout_millis = 11;
213+
214+
// Required options for broken link checker screenshot capability.
215+
message ScreenshotOptions {
216+
// Input bucket or folder provided by the user.
217+
string storage_location = 1;
218+
219+
enum CaptureCondition {
220+
NONE = 0;
221+
FAILING = 1;
222+
ALL = 2;
223+
}
224+
225+
// Controls when to capture screenshots during broken link checks, default
226+
// is FAILING.
227+
CaptureCondition capture_condition = 2;
228+
}
229+
230+
// Screenshot options, default to 'FAILING' and synthetic wide bucket.
231+
ScreenshotOptions screenshot_options = 12;
207232
}
208233

209234
// Options set for broken link synthetic.
@@ -217,7 +242,7 @@ message BrokenLinksResultV1 {
217242
ResponseStatusCode expected_status_code = 2;
218243
// Source_uri from which the target_uri is navigated from.
219244
string source_uri = 3;
220-
// target_uri navigated to from the source_uri.
245+
// Target_uri navigated to from the source_uri.
221246
string target_uri = 4;
222247
// Anchor text on the source URI.
223248
string anchor_text = 5;
@@ -235,15 +260,34 @@ message BrokenLinksResultV1 {
235260
string link_start_time = 10;
236261
// The end time of the link navigation in iso format.
237262
string link_end_time = 11;
238-
239263
// These fields only apply to the origin link.
240264
optional bool is_origin = 12;
265+
266+
// Result of Screenshot Upload to GCS.
267+
message ScreenshotOutput {
268+
// Name of screenshot_file.
269+
string screenshot_file = 1;
270+
271+
// Error that occurred throughout screenshot workflow.
272+
BaseError screenshot_error = 2;
273+
}
274+
275+
// Output of screenshot upload attempt.
276+
ScreenshotOutput screenshot_output = 13;
241277
}
242278

243-
// link result for origin_uri
279+
// link result for origin_uri.
244280
SyntheticLinkResult origin_link_result = 10;
245-
// link results for all scraped and followed links
281+
// link results for all scraped and followed links.
246282
repeated SyntheticLinkResult followed_link_results = 11;
283+
284+
// Path to the Cloud Storage folder where all artifacts (e.g. screenshots)
285+
// will be stored for this execution. e.g.
286+
// gs://<my_bucket_name/check-id-123/2024-01-01/123exec_id123/
287+
string execution_data_storage_path = 12;
288+
289+
// Errors associated with the broken link checker execution.
290+
repeated BaseError errors = 13;
247291
}
248292

249293
message SyntheticResult {
@@ -257,7 +301,6 @@ message SyntheticResult {
257301
// synthetic is running in, such as K_SERVICE, and K_REVISION for cloud run,
258302
// SYNTHETIC_SDK_NPM_PACKAGE_VERSION for nodejs package.
259303
map<string, string> runtime_metadata = 4;
260-
261304
// The start time of the synthetic in iso format.
262305
string start_time = 5;
263306
// The end time of the synthetic in iso format.

0 commit comments

Comments
 (0)