getMetrics method
Get metrics data for scripts, such as number of executions and active users.
Request parameters:
scriptId
- Required field indicating the script to get metrics for.
metricsFilter_deploymentId
- Optional field indicating a specific
deployment to retrieve metrics from.
metricsGranularity
- Required field indicating what granularity of
metrics are returned.
Possible string values are:
- "UNSPECIFIED_GRANULARITY" : Default metric granularity used to query no metrics.
- "WEEKLY" : Represents weekly metrics.
- "DAILY" : Represents daily metrics over a period of 7 days.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Metrics.
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<Metrics> getMetrics(
core.String scriptId, {
core.String? metricsFilter_deploymentId,
core.String? metricsGranularity,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (metricsFilter_deploymentId != null)
'metricsFilter.deploymentId': [metricsFilter_deploymentId],
if (metricsGranularity != null)
'metricsGranularity': [metricsGranularity],
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1/projects/' + commons.escapeVariable('$scriptId') + '/metrics';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return Metrics.fromJson(response_ as core.Map<core.String, core.dynamic>);
}