That sounds like maybe a urinary tract infection. You need to get your pup in in the morning. They can spread to the kidneys and bladder and actually become life threatening. If your pup already has blood in the urine then it's probably pretty bad. They can take 3+ weeks to treat sometimes so go back after the first course and make sure it's completely clear. My advice would be to have a urinalysis and culture done to know exactly what antibiotics are needed to treat it correctly. Otherwise it can just get worse, or seem better but soon you may be right back where you started. It actually usually costs less to have the tests done in the long run and saves your puppy a bit of pain.
Well if you got it fixed it might be because it is trying to pass a kidney stone but other wise it's probably because dogs have periods just like us humans do but you might want to take it to the vet just to be safe