getMetrics method

Future<JobMetrics> getMetrics(
  1. String projectId,
  2. String location,
  3. String jobId, {
  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.

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

jobId - The job to get metrics for.

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

  final _url = 'v1b3/projects/' +
      commons.escapeVariable('$projectId') +
      '/locations/' +
      commons.escapeVariable('$location') +
      '/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>);
}