createLogMetric method

Future<LogMetric> createLogMetric(
  1. CreateLogMetricRequest request
)

Creates a logs-based metric.

Throws a http.ClientException if there were problems communicating with the API service. Throws a StatusException if the API failed with a Status message. Throws a ServiceException for any other failure.

Implementation

Future<LogMetric> createLogMetric(CreateLogMetricRequest request) async {
  final url = Uri.https(_host, '/v2/${request.parent}/metrics');
  final response = await _client.post(url, body: request.metric);
  return LogMetric.fromJson(response);
}