getMetrics method

Future<JobMetrics> getMetrics(
  1. String projectId,
  2. String jobId, {
  3. String? location,
  4. String? startTime,
  5. String? $fields,
})

Request the job status.

To request the status of a job, we recommend using projects.locations.jobs.getMetrics with a regional endpoint. Using projects.jobs.getMetrics is not recommended, as you can only request the status of jobs that are running in us-central1.

Request parameters:

projectId - A project id.

jobId - The job to get metrics for.

location - The regional endpoint that contains the job specified by job_id.

startTime - Return only metric data that has changed since this time. Default is to return all information about all metrics for the job.

$fields - Selector specifying which fields to include in a partial response.

Completes with a JobMetrics.

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<JobMetrics> getMetrics(
  core.String projectId,
  core.String jobId, {
  core.String? location,
  core.String? startTime,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (location != null) 'location': [location],
    if (startTime != null) 'startTime': [startTime],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1b3/projects/' +
      commons.escapeVariable('$projectId') +
      '/jobs/' +
      commons.escapeVariable('$jobId') +
      '/metrics';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return JobMetrics.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}