Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
feat: Added support for secondary aggregation when querying metrics (#…
Browse files Browse the repository at this point in the history
…471)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/b9dd8574-10ed-4799-8623-fde41a50803e/targets

- [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)

PiperOrigin-RevId: 364422694
Source-Link: googleapis/googleapis@2124b62

feat: Added support for Monitoring Query Language: https://cloud.google.com/monitoring/mql 
feat: Added support for units in the MetricService 
feat: Added total_size to the response of ListAlertPolicies
fix: Un-deprecated cluster_istio for service monitoring
feat: Added IstioCanonicalService for service monitoring
feat: Added creation and mutation records to notification channels
feat: Added support for querying metrics for folders and organizations
fix: Extended the default deadline for UpdateGroup to 180s
  • Loading branch information
yoshi-automation committed Mar 29, 2021
1 parent 0cec022 commit 8a42810
Show file tree
Hide file tree
Showing 74 changed files with 10,035 additions and 1,288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public AlertPolicyServiceStub getStub() {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -202,7 +202,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(ResourceName name)

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -233,7 +233,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(OrganizationName n

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -264,7 +264,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(ProjectName name)

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -293,7 +293,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(String name) {

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -324,7 +324,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(ListAlertPoliciesR

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -356,7 +356,7 @@ public final ListAlertPoliciesPagedResponse listAlertPolicies(ListAlertPoliciesR

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists the existing alerting policies for the project.
* Lists the existing alerting policies for the workspace.
*
* <p>Sample code:
*
Expand Down Expand Up @@ -507,9 +507,11 @@ public final UnaryCallable<GetAlertPolicyRequest, AlertPolicy> getAlertPolicyCal
* @param name Required. The project in which to create the alerting policy. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* <p>Note that this field names the parent container in which the alerting policy will be
* written, not the name of the created policy. The alerting policy that is returned will have
* a name that contains a normalized representation of this name as a prefix but adds a suffix
* of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the container.
* written, not the name of the created policy. |name| must be a host project of a workspace,
* otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will
* have a name that contains a normalized representation of this name as a prefix but adds a
* suffix of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
* container.
* @param alertPolicy Required. The requested alerting policy. You should omit the `name` field in
* this policy. The name will be returned in the new policy, including a new
* `[ALERT_POLICY_ID]` value.
Expand Down Expand Up @@ -541,9 +543,11 @@ public final AlertPolicy createAlertPolicy(ResourceName name, AlertPolicy alertP
* @param name Required. The project in which to create the alerting policy. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* <p>Note that this field names the parent container in which the alerting policy will be
* written, not the name of the created policy. The alerting policy that is returned will have
* a name that contains a normalized representation of this name as a prefix but adds a suffix
* of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the container.
* written, not the name of the created policy. |name| must be a host project of a workspace,
* otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will
* have a name that contains a normalized representation of this name as a prefix but adds a
* suffix of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
* container.
* @param alertPolicy Required. The requested alerting policy. You should omit the `name` field in
* this policy. The name will be returned in the new policy, including a new
* `[ALERT_POLICY_ID]` value.
Expand Down Expand Up @@ -575,9 +579,11 @@ public final AlertPolicy createAlertPolicy(OrganizationName name, AlertPolicy al
* @param name Required. The project in which to create the alerting policy. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* <p>Note that this field names the parent container in which the alerting policy will be
* written, not the name of the created policy. The alerting policy that is returned will have
* a name that contains a normalized representation of this name as a prefix but adds a suffix
* of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the container.
* written, not the name of the created policy. |name| must be a host project of a workspace,
* otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will
* have a name that contains a normalized representation of this name as a prefix but adds a
* suffix of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
* container.
* @param alertPolicy Required. The requested alerting policy. You should omit the `name` field in
* this policy. The name will be returned in the new policy, including a new
* `[ALERT_POLICY_ID]` value.
Expand Down Expand Up @@ -610,9 +616,11 @@ public final AlertPolicy createAlertPolicy(ProjectName name, AlertPolicy alertPo
* @param name Required. The project in which to create the alerting policy. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* <p>Note that this field names the parent container in which the alerting policy will be
* written, not the name of the created policy. The alerting policy that is returned will have
* a name that contains a normalized representation of this name as a prefix but adds a suffix
* of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the container.
* written, not the name of the created policy. |name| must be a host project of a workspace,
* otherwise INVALID_ARGUMENT error will return. The alerting policy that is returned will
* have a name that contains a normalized representation of this name as a prefix but adds a
* suffix of the form `/alertPolicies/[ALERT_POLICY_ID]`, identifying the policy in the
* container.
* @param alertPolicy Required. The requested alerting policy. You should omit the `name` field in
* this policy. The name will be returned in the new policy, including a new
* `[ALERT_POLICY_ID]` value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,102 @@ public final void deleteMetricDescriptor(DeleteMetricDescriptorRequest request)
return stub.deleteMetricDescriptorCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists time series that match a filter. This method does not require a Workspace.
*
* <p>Sample code:
*
* <pre>{@code
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* ResourceName name = ResourceName.of("[FOLDER]");
* String filter = "filter-1274492040";
* TimeInterval interval = TimeInterval.newBuilder().build();
* ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.forNumber(0);
* for (TimeSeries element :
* metricServiceClient.listTimeSeries(name, filter, interval, view).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param name Required. The project, organization or folder on which to execute the request. The
* format is:
* <p>projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID]
* @param filter Required. A [monitoring
* filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time
* series should be returned. The filter must specify a single metric type, and can
* additionally specify metric labels and other information. For example:
* <p>metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
* metric.labels.instance_name = "my-instance-name"
* @param interval Required. The time interval for which results should be returned. Only time
* series that contain data points in the specified interval are included in the response.
* @param view Required. Specifies which information is returned about the time series.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListTimeSeriesPagedResponse listTimeSeries(
ResourceName name,
String filter,
TimeInterval interval,
ListTimeSeriesRequest.TimeSeriesView view) {
ListTimeSeriesRequest request =
ListTimeSeriesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setFilter(filter)
.setInterval(interval)
.setView(view)
.build();
return listTimeSeries(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists time series that match a filter. This method does not require a Workspace.
*
* <p>Sample code:
*
* <pre>{@code
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* OrganizationName name = OrganizationName.of("[ORGANIZATION]");
* String filter = "filter-1274492040";
* TimeInterval interval = TimeInterval.newBuilder().build();
* ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.forNumber(0);
* for (TimeSeries element :
* metricServiceClient.listTimeSeries(name, filter, interval, view).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @param name Required. The project, organization or folder on which to execute the request. The
* format is:
* <p>projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID]
* @param filter Required. A [monitoring
* filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time
* series should be returned. The filter must specify a single metric type, and can
* additionally specify metric labels and other information. For example:
* <p>metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND
* metric.labels.instance_name = "my-instance-name"
* @param interval Required. The time interval for which results should be returned. Only time
* series that contain data points in the specified interval are included in the response.
* @param view Required. Specifies which information is returned about the time series.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListTimeSeriesPagedResponse listTimeSeries(
OrganizationName name,
String filter,
TimeInterval interval,
ListTimeSeriesRequest.TimeSeriesView view) {
ListTimeSeriesRequest request =
ListTimeSeriesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setFilter(filter)
.setInterval(interval)
.setView(view)
.build();
return listTimeSeries(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists time series that match a filter. This method does not require a Workspace.
Expand All @@ -1155,8 +1251,9 @@ public final void deleteMetricDescriptor(DeleteMetricDescriptorRequest request)
* }
* }</pre>
*
* @param name Required. The project on which to execute the request. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* @param name Required. The project, organization or folder on which to execute the request. The
* format is:
* <p>projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID]
* @param filter Required. A [monitoring
* filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time
* series should be returned. The filter must specify a single metric type, and can
Expand Down Expand Up @@ -1191,7 +1288,7 @@ public final ListTimeSeriesPagedResponse listTimeSeries(
*
* <pre>{@code
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* String name = ProjectName.of("[PROJECT]").toString();
* String name = TimeSeriesName.ofProjectTimeSeriesName("[PROJECT]", "[TIME_SERIES]").toString();
* String filter = "filter-1274492040";
* TimeInterval interval = TimeInterval.newBuilder().build();
* ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.forNumber(0);
Expand All @@ -1202,8 +1299,9 @@ public final ListTimeSeriesPagedResponse listTimeSeries(
* }
* }</pre>
*
* @param name Required. The project on which to execute the request. The format is:
* <p>projects/[PROJECT_ID_OR_NUMBER]
* @param name Required. The project, organization or folder on which to execute the request. The
* format is:
* <p>projects/[PROJECT_ID_OR_NUMBER] organizations/[ORGANIZATION_ID] folders/[FOLDER_ID]
* @param filter Required. A [monitoring
* filter](https://cloud.google.com/monitoring/api/v3/filters) that specifies which time
* series should be returned. The filter must specify a single metric type, and can
Expand Down Expand Up @@ -1240,10 +1338,12 @@ public final ListTimeSeriesPagedResponse listTimeSeries(
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* ListTimeSeriesRequest request =
* ListTimeSeriesRequest.newBuilder()
* .setName(ProjectName.of("[PROJECT]").toString())
* .setName(
* TimeSeriesName.ofProjectTimeSeriesName("[PROJECT]", "[TIME_SERIES]").toString())
* .setFilter("filter-1274492040")
* .setInterval(TimeInterval.newBuilder().build())
* .setAggregation(Aggregation.newBuilder().build())
* .setSecondaryAggregation(Aggregation.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
Expand Down Expand Up @@ -1271,10 +1371,12 @@ public final ListTimeSeriesPagedResponse listTimeSeries(ListTimeSeriesRequest re
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* ListTimeSeriesRequest request =
* ListTimeSeriesRequest.newBuilder()
* .setName(ProjectName.of("[PROJECT]").toString())
* .setName(
* TimeSeriesName.ofProjectTimeSeriesName("[PROJECT]", "[TIME_SERIES]").toString())
* .setFilter("filter-1274492040")
* .setInterval(TimeInterval.newBuilder().build())
* .setAggregation(Aggregation.newBuilder().build())
* .setSecondaryAggregation(Aggregation.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
Expand Down Expand Up @@ -1303,10 +1405,12 @@ public final ListTimeSeriesPagedResponse listTimeSeries(ListTimeSeriesRequest re
* try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
* ListTimeSeriesRequest request =
* ListTimeSeriesRequest.newBuilder()
* .setName(ProjectName.of("[PROJECT]").toString())
* .setName(
* TimeSeriesName.ofProjectTimeSeriesName("[PROJECT]", "[TIME_SERIES]").toString())
* .setFilter("filter-1274492040")
* .setInterval(TimeInterval.newBuilder().build())
* .setAggregation(Aggregation.newBuilder().build())
* .setSecondaryAggregation(Aggregation.newBuilder().build())
* .setOrderBy("orderBy-1207110587")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
Expand Down
Loading

0 comments on commit 8a42810

Please sign in to comment.