added public method that will cancel the metrics task.