It really just depends on your relationship with people. The people that I work closely with at my job know about my surgery. I told them all before I even go the surgery to just get it out there. There are many other employees who work at our office, and I didn't tell everyone. There was no need. If someone I didn't tell says something, I usually just acknowledge that I've lost weight and leave it at that. If they really want to know how, I tell them. I'm not concerned about their opinion.
As for my family. My wife, daughter and parents know. A handful of close family friends know. I have two brothers and sisters-in-law that I'm not particularly close with, so they do not know and I will probably will not bring it up. I have many Facebook and social media friends, but I don't post things there, although I'm sure if they suspected something and really wanted to find out they could. It's not like my YouTube channel is private or anything, but most people don't have a reason to search for me on that topic.
So as you can see, it just depends on your relationships. Many people are very private about it, some are very open, and I think most are somewhere in between.