report method
Reports operation results to Google Service Control, such as logs and metrics.
It should be called after an operation is completed. If feasible, the
client should aggregate reporting data for up to 5 seconds to reduce API
traffic. Limiting aggregation to 5 seconds is to reduce data loss during
client crashes. Clients should carefully choose the aggregation time
window to avoid data loss risk more than 0.01% for business and compliance
reasons. NOTE: the ReportRequest has the size limit (wire-format byte
size) of 1MB. This method requires the servicemanagement.services.report
permission on the specified service. For more information, see
Google Cloud IAM.
request
- The metadata request object.
Request parameters:
serviceName
- The service name as specified in its service
configuration. For example, "pubsub.googleapis.com"
. See
google.api.Service
for the definition of a service name.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ReportResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<ReportResponse> report(
ReportRequest request,
core.String serviceName, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1/services/' + commons.escapeVariable('$serviceName') + ':report';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return ReportResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}