The choice of how much pain is worth it for how much of a chance at a longer life is going to look different depending on your religion, your responsibilities, your age, your experiences with pain, your family, your culture, etc. And yes, of course the cost of treatment will factor into that decision for both the doctors and the patient.
In a world where the only available treatment is blood-letting or getting your limbed sawed off by a hacksaw, a "do not resuscitate" policy is clearly more rational than in the Star Trek/sci-fi world where treatment consists of a doctor waving a magic iPad over your head and nanobots cure you painlessly. Since we're somewhere in between those two it becomes more complicated, but evaluating the risks and benefits and making an as informed choice as possible based on the available information still seems to me to be the rational way to look at it. Making future medical decisions based on an emotional reaction to individual cases, on the other hand, seems to me to be irrational and counter-productive.
Having seen his tour of the medical system, I desperately hope that if I were ever in that position, I'd have the strength to say no: treat the pain and I'll die in peace.
I have friends who are medical professionals and I don't recognize them in this either: I highly doubt any of them have NO CODE tattoos or anything equivalent. I suspect society shouldering most of the cost might be a factor: with a privatized payment system, there are perhaps incentives to go too far that aren't there when there's no profit to be made? That's pure conjecture, though.