Skip to content

Commit b5532bb

Browse files
Google APIscopybara-github
authored andcommitted
feat: added validation only mode when writing dashboards
feat: added alert chart widget PiperOrigin-RevId: 383440655
1 parent a9d8182 commit b5532bb

7 files changed

Lines changed: 68 additions & 25 deletions

File tree

google/monitoring/dashboard/v1/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
2323
proto_library(
2424
name = "dashboard_proto",
2525
srcs = [
26+
"alertchart.proto",
2627
"common.proto",
2728
"dashboard.proto",
2829
"dashboards_service.proto",
@@ -212,6 +213,7 @@ php_gapic_library(
212213
name = "dashboard_php_gapic",
213214
srcs = [":dashboard_proto_with_info"],
214215
grpc_service_config = "dashboards_grpc_service_config.json",
216+
service_yaml = "monitoring.yaml",
215217
deps = [
216218
":dashboard_php_grpc",
217219
":dashboard_php_proto",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.monitoring.dashboard.v1;
18+
19+
import "google/api/field_behavior.proto";
20+
import "google/api/resource.proto";
21+
22+
option go_package = "google.golang.org/genproto/googleapis/monitoring/dashboard/v1;dashboard";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "AlertChartProto";
25+
option java_package = "com.google.monitoring.dashboard.v1";
26+
option php_namespace = "Google\\Cloud\\Monitoring\\Dashboard\\V1";
27+
option ruby_package = "Google::Cloud::Monitoring::Dashboard::V1";
28+
29+
// A chart that displays alert policy data.
30+
message AlertChart {
31+
option (google.api.resource) = {
32+
type: "monitoring.googleapis.com/AlertPolicy"
33+
pattern: "projects/{project}/alertPolicies/{alert_policy}"
34+
};
35+
36+
// Required. The resource name of the alert policy. The format is:
37+
//
38+
// projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]
39+
string name = 1 [(google.api.field_behavior) = REQUIRED];
40+
}

google/monitoring/dashboard/v1/dashboards_service.proto

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,8 @@ service DashboardsService {
4141
"https://www.googleapis.com/auth/monitoring.read,"
4242
"https://www.googleapis.com/auth/monitoring.write";
4343

44-
// Creates a new custom dashboard. For examples on how you can use this API to
45-
// create dashboards, see [Managing dashboards by
46-
// API](https://cloud.google.com/monitoring/dashboards/api-dashboard). This method requires the
47-
// `monitoring.dashboards.create` permission on the specified project. For
48-
// more information about permissions, see [Cloud Identity and Access
49-
// Management](https://cloud.google.com/iam).
44+
// Creates a new custom dashboard. For examples on how you can use this API to create dashboards, see [Managing dashboards by API](/monitoring/dashboards/api-dashboard).
45+
// This method requires the `monitoring.dashboards.create` permission on the specified project. For more information about permissions, see [Cloud Identity and Access Management](/iam).
5046
rpc CreateDashboard(CreateDashboardRequest) returns (Dashboard) {
5147
option (google.api.http) = {
5248
post: "/v1/{parent=projects/*}/dashboards"
@@ -111,6 +107,10 @@ message CreateDashboardRequest {
111107

112108
// Required. The initial dashboard specification.
113109
Dashboard dashboard = 2 [(google.api.field_behavior) = REQUIRED];
110+
111+
// If set, validate the request and preview the review, but do not actually
112+
// save it.
113+
bool validate_only = 3;
114114
}
115115

116116
// The `ListDashboards` request.
@@ -178,4 +178,8 @@ message DeleteDashboardRequest {
178178
message UpdateDashboardRequest {
179179
// Required. The dashboard that will replace the existing dashboard.
180180
Dashboard dashboard = 1 [(google.api.field_behavior) = REQUIRED];
181+
182+
// If set, validate the request and preview the review, but do not actually
183+
// save it.
184+
bool validate_only = 3;
181185
}

google/monitoring/dashboard/v1/metrics.proto

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ message TimeSeriesQuery {
5454
// [`ListTimeSeries`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list)
5555
// method.
5656
message TimeSeriesFilter {
57-
// Required. The [monitoring
58-
// filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies
59-
// the metric types, resources, and projects to query.
57+
// Required. The [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters)
58+
// that identifies the metric types, resources, and projects to query.
6059
string filter = 1 [(google.api.field_behavior) = REQUIRED];
6160

6261
// By default, the raw time series data is returned.
@@ -74,8 +73,7 @@ message TimeSeriesFilter {
7473

7574
// Statistics based time series filter.
7675
// Note: This field is deprecated and completely ignored by the API.
77-
StatisticalTimeSeriesFilter statistical_time_series_filter = 5
78-
[deprecated = true];
76+
StatisticalTimeSeriesFilter statistical_time_series_filter = 5 [deprecated = true];
7977
}
8078
}
8179

@@ -114,8 +112,7 @@ message TimeSeriesFilterRatio {
114112

115113
// Statistics based time series filter.
116114
// Note: This field is deprecated and completely ignored by the API.
117-
StatisticalTimeSeriesFilter statistical_time_series_filter = 5
118-
[deprecated = true];
115+
StatisticalTimeSeriesFilter statistical_time_series_filter = 5 [deprecated = true];
119116
}
120117
}
121118

google/monitoring/dashboard/v1/scorecard.proto

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ message Scorecard {
5050
// timeseries.
5151
message SparkChartView {
5252
// Required. The type of sparkchart to show in this chartView.
53-
SparkChartType spark_chart_type = 1
54-
[(google.api.field_behavior) = REQUIRED];
53+
SparkChartType spark_chart_type = 1 [(google.api.field_behavior) = REQUIRED];
5554

5655
// The lower bound on data point frequency in the chart implemented by
5756
// specifying the minimum alignment period to use in a time series query.
@@ -63,8 +62,7 @@ message Scorecard {
6362

6463
// Required. Fields for querying time series data from the
6564
// Stackdriver metrics API.
66-
TimeSeriesQuery time_series_query = 1
67-
[(google.api.field_behavior) = REQUIRED];
65+
TimeSeriesQuery time_series_query = 1 [(google.api.field_behavior) = REQUIRED];
6866

6967
// Defines the optional additional chart shown on the scorecard. If
7068
// neither is included - then a default scorecard is shown.

google/monitoring/dashboard/v1/widget.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.monitoring.dashboard.v1;
1818

1919
import "google/api/field_behavior.proto";
20+
import "google/monitoring/dashboard/v1/alertchart.proto";
2021
import "google/monitoring/dashboard/v1/scorecard.proto";
2122
import "google/monitoring/dashboard/v1/text.proto";
2223
import "google/monitoring/dashboard/v1/xychart.proto";
@@ -48,5 +49,8 @@ message Widget {
4849

4950
// A blank space.
5051
google.protobuf.Empty blank = 5;
52+
53+
// A chart of alert policy data.
54+
AlertChart alert_chart = 7;
5155
}
5256
}

google/monitoring/dashboard/v1/xychart.proto

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ message XyChart {
6060

6161
// Required. Fields for querying time series data from the
6262
// Stackdriver metrics API.
63-
TimeSeriesQuery time_series_query = 1
64-
[(google.api.field_behavior) = REQUIRED];
63+
TimeSeriesQuery time_series_query = 1 [(google.api.field_behavior) = REQUIRED];
6564

6665
// How this data should be plotted on the chart.
6766
PlotType plot_type = 2;
@@ -71,13 +70,12 @@ message XyChart {
7170
// which will resolve to the label's value.
7271
string legend_template = 3;
7372

74-
// Optional. The lower bound on data point frequency for this data set,
75-
// implemented by specifying the minimum alignment period to use in a time
76-
// series query. For example, if the data is published once every 10 minutes,
77-
// the `min_alignment_period` should be at least 10 minutes. It would not
73+
// Optional. The lower bound on data point frequency for this data set, implemented by
74+
// specifying the minimum alignment period to use in a time series query
75+
// For example, if the data is published once every 10 minutes, the
76+
// `min_alignment_period` should be at least 10 minutes. It would not
7877
// make sense to fetch and align data at one minute intervals.
79-
google.protobuf.Duration min_alignment_period = 4
80-
[(google.api.field_behavior) = OPTIONAL];
78+
google.protobuf.Duration min_alignment_period = 4 [(google.api.field_behavior) = OPTIONAL];
8179
}
8280

8381
// A chart axis.

0 commit comments

Comments
 (0)