Here is my anal gland schpeel: First off, are you familiar with what anal glands are? Just in case, and maybe for others reading, I'll explain. They are two sacs on either side of the inside of the rectum. They are not very deep and are positioned at 10:00 and 2:00. The original purpose of these delightful little sacs was for scenting. Whenever a dog (or cat for that matter) has a bowel movement, the poop should be firm enough to express the anal glands as the poop comes out - like popping two big zits!! I know, totally gross and crude, but true. What happens with dogs that have 'anal gland issues' is one or more of a few things.
First, and most often, the dog is just having soft stools. It doesn't have to be diarrhea, formed, but soft is enough. This is often diet related. If this is the case, simple fix, slowly switch foods. My Pitty had a similar problem. After 5 years, we finally found the right food to switch to and, presto, firm poops! No more pealing poop out of the grass for us! The food you are currently feeding may be good in the other departments, but if it isn't good in all of them, a switch is in order! Sometimes just adding a probiotic formulated for dogs to a food is enough to solve the problem. Parasites could also be the culprit - like Giardia!
Next, they could be infected. Maybe she had a bout of diarrhea and they filled and filled and filled and couldn't express. The system is now backed up. They can get so full and inflamed, that they get infected. This means you have to have them expressed even more than usual, and they are painful. This can typically be seen by a vet when they are expressed because the goo that comes out is green (gross), white or bloody.
Lastly, it could be positional. If the little opening to the sac is not 'facing the right way' no matter how firm her poops are, those sacs aren't gonna pop. There isn't much you can do for these guys but constant visits to the vet or groomer or surgery.
Surgery is an option, but, risky. Besides the risks of anesthesia, let's face it, the inside of the rectum is not the most sterile place in the world. The risk of infection is very high. Also, if the doctor has an oops and slips, your dog may never be able to hold her poop in again! Scary, but true. The muscles around the rectum are very important. I have seen the surgery done successfully many times, but the risk is there.
You can try adding some prescription food to her diet (Purina OM, or Science Diet w/d) I don't particularly like either of these companies, but their prescription foods are very effective. That is high in fiber and will help firm up her poops. (or you can add some metamucil to her food) If a few weeks of this works and the anal gland problems disappear, then you know it is food related. In order for this little 'food trial' to be really effective, you would have to cut back on the treats for the time so you can be sure your experiment is controlled. Both of my dogs have happy anal glands now. The only time I worry about them is about 3 days after diarrhea clears up (usually from getting into something). Then I just do it and don't worry. I know a girl with a Presa that was giving yogurt as a probiotic and he couldn't tolerate it, so he always had anal gland problems because his poops were always soft. She stopped that and the problem stopped.
I recommend that you don't quickly jump to surgery. There are many other permanent fixes. Good luck and let me know if this helps!