Skip to content

Commit 6f3fcc0

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add ICMP pings
feat: Add basic http authentication feat: Add json path matching capabilities feat: Add httpStatusCode feat: Add individual USA regions PiperOrigin-RevId: 529400435
1 parent e6c8485 commit 6f3fcc0

2 files changed

Lines changed: 223 additions & 55 deletions

File tree

google/monitoring/v3/uptime.proto

Lines changed: 209 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021 Google LLC
1+
// Copyright 2023 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.monitoring.v3;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/api/monitored_resource.proto";
2021
import "google/api/resource.proto";
2122
import "google/protobuf/duration.proto";
@@ -59,13 +60,13 @@ message InternalChecker {
5960
//
6061
// projects/[PROJECT_ID_OR_NUMBER]/internalCheckers/[INTERNAL_CHECKER_ID]
6162
//
62-
// `[PROJECT_ID_OR_NUMBER]` is the Stackdriver Workspace project for the
63-
// Uptime check config associated with the internal checker.
63+
// `[PROJECT_ID_OR_NUMBER]` is the Cloud Monitoring Metrics Scope project for
64+
// the Uptime check config associated with the internal checker.
6465
string name = 1;
6566

6667
// The checker's human-readable name. The display name
67-
// should be unique within a Stackdriver Workspace in order to make it easier
68-
// to identify; however, uniqueness is not enforced.
68+
// should be unique within a Cloud Monitoring Metrics Scope in order to make
69+
// it easier to identify; however, uniqueness is not enforced.
6970
string display_name = 2;
7071

7172
// The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the
@@ -77,34 +78,13 @@ message InternalChecker {
7778
string gcp_zone = 4;
7879

7980
// The GCP project ID where the internal checker lives. Not necessary
80-
// the same as the Workspace project.
81+
// the same as the Metrics Scope project.
8182
string peer_project_id = 6;
8283

8384
// The current operational state of the internal checker.
8485
State state = 7;
8586
}
8687

87-
// The regions from which an Uptime check can be run.
88-
enum UptimeCheckRegion {
89-
// Default value if no region is specified. Will result in Uptime checks
90-
// running from all regions.
91-
REGION_UNSPECIFIED = 0;
92-
93-
// Allows checks to run from locations within the United States of America.
94-
USA = 1;
95-
96-
// Allows checks to run from locations within the continent of Europe.
97-
EUROPE = 2;
98-
99-
// Allows checks to run from locations within the continent of South
100-
// America.
101-
SOUTH_AMERICA = 3;
102-
103-
// Allows checks to run from locations within the Asia Pacific area (ex:
104-
// Singapore).
105-
ASIA_PACIFIC = 4;
106-
}
107-
10888
// This message configures which resources and services to monitor for
10989
// availability.
11090
message UptimeCheckConfig {
@@ -128,20 +108,16 @@ message UptimeCheckConfig {
128108
GroupResourceType resource_type = 2;
129109
}
130110

111+
// Information involved in sending ICMP pings alongside public HTTP/TCP
112+
// checks. For HTTP, the pings are performed for each part of the redirect
113+
// chain.
114+
message PingConfig {
115+
// Number of ICMP pings. A maximum of 3 ICMP pings is currently supported.
116+
int32 pings_count = 1;
117+
}
118+
131119
// Information involved in an HTTP/HTTPS Uptime check request.
132120
message HttpCheck {
133-
// The authentication parameters to provide to the specified resource or
134-
// URL that requires a username and password. Currently, only
135-
// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
136-
// supported in Uptime checks.
137-
message BasicAuthentication {
138-
// The username to use when authenticating with the HTTP server.
139-
string username = 1;
140-
141-
// The password to use when authenticating with the HTTP server.
142-
string password = 2;
143-
}
144-
145121
// The HTTP request method options.
146122
enum RequestMethod {
147123
// No request method specified.
@@ -154,6 +130,18 @@ message UptimeCheckConfig {
154130
POST = 2;
155131
}
156132

133+
// The authentication parameters to provide to the specified resource or
134+
// URL that requires a username and password. Currently, only
135+
// [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is
136+
// supported in Uptime checks.
137+
message BasicAuthentication {
138+
// The username to use when authenticating with the HTTP server.
139+
string username = 1;
140+
141+
// The password to use when authenticating with the HTTP server.
142+
string password = 2;
143+
}
144+
157145
// Header options corresponding to the content type of a HTTP request body.
158146
enum ContentType {
159147
// No content type specified.
@@ -162,6 +150,48 @@ message UptimeCheckConfig {
162150
// `body` is in URL-encoded form. Equivalent to setting the `Content-Type`
163151
// to `application/x-www-form-urlencoded` in the HTTP request.
164152
URL_ENCODED = 1;
153+
154+
// `body` is in `custom_content_type` form. Equivalent to setting the
155+
// `Content-Type` to the contents of `custom_content_type` in the HTTP
156+
// request.
157+
USER_PROVIDED = 2;
158+
}
159+
160+
// A status to accept. Either a status code class like "2xx", or an integer
161+
// status code like "200".
162+
message ResponseStatusCode {
163+
// An HTTP status code class.
164+
enum StatusClass {
165+
// Default value that matches no status codes.
166+
STATUS_CLASS_UNSPECIFIED = 0;
167+
168+
// The class of status codes between 100 and 199.
169+
STATUS_CLASS_1XX = 100;
170+
171+
// The class of status codes between 200 and 299.
172+
STATUS_CLASS_2XX = 200;
173+
174+
// The class of status codes between 300 and 399.
175+
STATUS_CLASS_3XX = 300;
176+
177+
// The class of status codes between 400 and 499.
178+
STATUS_CLASS_4XX = 400;
179+
180+
// The class of status codes between 500 and 599.
181+
STATUS_CLASS_5XX = 500;
182+
183+
// The class of all status codes.
184+
STATUS_CLASS_ANY = 1000;
185+
}
186+
187+
// Either a specific value or a class of status codes.
188+
oneof status_code {
189+
// A status code to accept.
190+
int32 status_value = 1;
191+
192+
// A class of status codes to accept.
193+
StatusClass status_class = 2;
194+
}
165195
}
166196

167197
// The HTTP request method to use for the check. If set to
@@ -216,6 +246,14 @@ message UptimeCheckConfig {
216246
// `headers` field. The `content_type` field should be used instead.
217247
ContentType content_type = 9;
218248

249+
// A user provided content type header to use for the check. The invalid
250+
// configurations outlined in the `content_type` field apply to
251+
// `custom_content_type`, as well as the following:
252+
// 1. `content_type` is `URL_ENCODED` and `custom_content_type` is set.
253+
// 2. `content_type` is `USER_PROVIDED` and `custom_content_type` is not
254+
// set.
255+
string custom_content_type = 13;
256+
219257
// Boolean specifying whether to include SSL certificate validation as a
220258
// part of the Uptime check. Only applies to checks where
221259
// `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`,
@@ -226,11 +264,20 @@ message UptimeCheckConfig {
226264
// is `URL_ENCODED`, the body passed in must be URL-encoded. Users can
227265
// provide a `Content-Length` header via the `headers` field or the API will
228266
// do so. If the `request_method` is `GET` and `body` is not empty, the API
229-
// will return an error. The maximum byte size is 1 megabyte. Note: As with
230-
// all `bytes` fields, JSON representations are base64 encoded. e.g.:
231-
// "foo=bar" in URL-encoded form is "foo%3Dbar" and in base64 encoding is
232-
// "Zm9vJTI1M0RiYXI=".
267+
// will return an error. The maximum byte size is 1 megabyte.
268+
//
269+
// Note: If client libraries aren't used (which performs the conversion
270+
// automatically) base64 encode your `body` data since the field is of
271+
// `bytes` type.
233272
bytes body = 10;
273+
274+
// If present, the check will only pass if the HTTP response status code is
275+
// in this set of status codes. If empty, the HTTP status code will only
276+
// pass if the HTTP status code is 200-299.
277+
repeated ResponseStatusCode accepted_response_status_codes = 11;
278+
279+
// Contains information needed to add pings to an HTTP check.
280+
PingConfig ping_config = 12;
234281
}
235282

236283
// Information required for a TCP Uptime check request.
@@ -239,6 +286,9 @@ message UptimeCheckConfig {
239286
// combined with host (specified within the `monitored_resource`) to
240287
// construct the full URL. Required.
241288
int32 port = 1;
289+
290+
// Contains information needed to add pings to a TCP check.
291+
PingConfig ping_config = 2;
242292
}
243293

244294
// Optional. Used to perform content matching. This allows matching based on
@@ -264,7 +314,7 @@ message UptimeCheckConfig {
264314
// output does _NOT_ contain the `content` string.
265315
NOT_CONTAINS_STRING = 2;
266316

267-
// Selects regular-expression matching. The match succeeds of the output
317+
// Selects regular-expression matching. The match succeeds if the output
268318
// matches the regular expression specified in the `content` string.
269319
// Regex matching is only supported for HTTP/HTTPS checks.
270320
MATCHES_REGEX = 3;
@@ -274,15 +324,79 @@ message UptimeCheckConfig {
274324
// `content` string. Regex matching is only supported for HTTP/HTTPS
275325
// checks.
276326
NOT_MATCHES_REGEX = 4;
327+
328+
// Selects JSONPath matching. See `JsonPathMatcher` for details on when
329+
// the match succeeds. JSONPath matching is only supported for HTTP/HTTPS
330+
// checks.
331+
MATCHES_JSON_PATH = 5;
332+
333+
// Selects JSONPath matching. See `JsonPathMatcher` for details on when
334+
// the match succeeds. Succeeds when output does _NOT_ match as specified.
335+
// JSONPath is only supported for HTTP/HTTPS checks.
336+
NOT_MATCHES_JSON_PATH = 6;
277337
}
278338

279-
// String or regex content to match. Maximum 1024 bytes. An empty `content`
280-
// string indicates no content matching is to be performed.
339+
// Information needed to perform a JSONPath content match.
340+
// Used for `ContentMatcherOption::MATCHES_JSON_PATH` and
341+
// `ContentMatcherOption::NOT_MATCHES_JSON_PATH`.
342+
message JsonPathMatcher {
343+
// Options to perform JSONPath content matching.
344+
enum JsonPathMatcherOption {
345+
// No JSONPath matcher type specified (not valid).
346+
JSON_PATH_MATCHER_OPTION_UNSPECIFIED = 0;
347+
348+
// Selects 'exact string' matching. The match succeeds if the content at
349+
// the `json_path` within the output is exactly the same as the
350+
// `content` string.
351+
EXACT_MATCH = 1;
352+
353+
// Selects regular-expression matching. The match succeeds if the
354+
// content at the `json_path` within the output matches the regular
355+
// expression specified in the `content` string.
356+
REGEX_MATCH = 2;
357+
}
358+
359+
// JSONPath within the response output pointing to the expected
360+
// `ContentMatcher::content` to match against.
361+
string json_path = 1;
362+
363+
// The type of JSONPath match that will be applied to the JSON output
364+
// (`ContentMatcher.content`)
365+
JsonPathMatcherOption json_matcher = 2;
366+
}
367+
368+
// String, regex or JSON content to match. Maximum 1024 bytes. An empty
369+
// `content` string indicates no content matching is to be performed.
281370
string content = 1;
282371

283372
// The type of content matcher that will be applied to the server output,
284373
// compared to the `content` string when the check is run.
285374
ContentMatcherOption matcher = 2;
375+
376+
// Certain `ContentMatcherOption` types require additional information.
377+
// `MATCHES_JSON_PATH` or `NOT_MATCHES_JSON_PATH` require a
378+
// `JsonPathMatcher`; not used for other options.
379+
oneof additional_matcher_info {
380+
// Matcher information for `MATCHES_JSON_PATH` and `NOT_MATCHES_JSON_PATH`
381+
JsonPathMatcher json_path_matcher = 3;
382+
}
383+
}
384+
385+
// What kind of checkers are available to be used by the check.
386+
enum CheckerType {
387+
// The default checker type. Currently converted to `STATIC_IP_CHECKERS`
388+
// on creation, the default conversion behavior may change in the future.
389+
CHECKER_TYPE_UNSPECIFIED = 0;
390+
391+
// `STATIC_IP_CHECKERS` are used for uptime checks that perform egress
392+
// across the public internet. `STATIC_IP_CHECKERS` use the static IP
393+
// addresses returned by `ListUptimeCheckIps`.
394+
STATIC_IP_CHECKERS = 1;
395+
396+
// `VPC_CHECKERS` are used for uptime checks that perform egress using
397+
// Service Directory and private network access. When using `VPC_CHECKERS`,
398+
// the monitored resource type must be `servicedirectory_service`.
399+
VPC_CHECKERS = 3;
286400
}
287401

288402
// A unique resource name for this Uptime check configuration. The format is:
@@ -298,8 +412,8 @@ message UptimeCheckConfig {
298412
string name = 1;
299413

300414
// A human-friendly name for the Uptime check configuration. The display name
301-
// should be unique within a Stackdriver Workspace in order to make it easier
302-
// to identify; however, uniqueness is not enforced. Required.
415+
// should be unique within a Cloud Monitoring Workspace in order to make it
416+
// easier to identify; however, uniqueness is not enforced. Required.
303417
string display_name = 2;
304418

305419
// The resource the check is checking. Required.
@@ -314,6 +428,8 @@ message UptimeCheckConfig {
314428
// `aws_ec2_instance`,
315429
// `aws_elb_load_balancer`
316430
// `k8s_service`
431+
// `servicedirectory_service`
432+
// `cloud_run_revision`
317433
google.api.MonitoredResource monitored_resource = 3;
318434

319435
// The group resource associated with the configuration.
@@ -346,6 +462,9 @@ message UptimeCheckConfig {
346462
// content match is required as part of the/ Uptime check.
347463
repeated ContentMatcher content_matchers = 9;
348464

465+
// The type of checkers to use to execute the Uptime check.
466+
CheckerType checker_type = 17;
467+
349468
// The list of regions from which the check will be run.
350469
// Some regions contain one location, and others contain more than one.
351470
// If this field is specified, enough regions must be provided to include a
@@ -364,6 +483,15 @@ message UptimeCheckConfig {
364483
// InternalCheckers configured for the project that owns this
365484
// `UptimeCheckConfig`.
366485
repeated InternalChecker internal_checkers = 14 [deprecated = true];
486+
487+
// User-supplied key/value data to be used for organizing and
488+
// identifying the `UptimeCheckConfig` objects.
489+
//
490+
// The field can contain up to 64 entries. Each key and value is limited to
491+
// 63 Unicode characters or 128 bytes, whichever is smaller. Labels and
492+
// values can contain only lowercase letters, numerals, underscores, and
493+
// dashes. Keys must begin with a letter.
494+
map<string, string> user_labels = 20;
367495
}
368496

369497
// Contains the region, location, and list of IP
@@ -385,6 +513,39 @@ message UptimeCheckIp {
385513
string ip_address = 3;
386514
}
387515

516+
// The regions from which an Uptime check can be run.
517+
enum UptimeCheckRegion {
518+
// Default value if no region is specified. Will result in Uptime checks
519+
// running from all regions.
520+
REGION_UNSPECIFIED = 0;
521+
522+
// Allows checks to run from locations within the United States of America.
523+
USA = 1;
524+
525+
// Allows checks to run from locations within the continent of Europe.
526+
EUROPE = 2;
527+
528+
// Allows checks to run from locations within the continent of South
529+
// America.
530+
SOUTH_AMERICA = 3;
531+
532+
// Allows checks to run from locations within the Asia Pacific area (ex:
533+
// Singapore).
534+
ASIA_PACIFIC = 4;
535+
536+
// Allows checks to run from locations within the western United States of
537+
// America
538+
USA_OREGON = 5;
539+
540+
// Allows checks to run from locations within the central United States of
541+
// America
542+
USA_IOWA = 6;
543+
544+
// Allows checks to run from locations within the eastern United States of
545+
// America
546+
USA_VIRGINIA = 7;
547+
}
548+
388549
// The supported resource types that can be used as values of
389550
// `group_resource.resource_type`.
390551
// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types.

0 commit comments

Comments
 (0)