I think generally police are on a specific assignment or detail, and how much discretion they have depends on their assignment, combined with any possible ‘backlash factor’.
For example, if you are on the narcotics squad, you probably have less discretion to ignore witnessing of drug use, but you can safely ignore other minor violations.
But if you are on traffic patrol, you probably just look out for traffic violations and don’t pay too much attention to the random minor law violation that isn’t car-based.
Sometimes you have top-down more specific instruction than your general assignment - hence the seasonal police stop points for DWI or seat belts or whatever.
But, no matter what your assignment, if you happen to encounter something truly police worthy (serious victim crime), you are likely to intervene, if not for your own moral guidance, then because if it’s something people are likely to complain about, then your ass will be in a sling if you don’t respond.
I believe also, a higher-up can specifically instruct the lower downs to not bother enforcing certain laws.
To summarize: if the head honcho of whatever sort wants a law enforced, it’s gonna be. If they don’t want it enforced, it’s not gonna be. If they don’t give instruction, then it depends on the specific assignment. And in general, no one gives a shit about blue laws, unless it lets them arrest someone who they suspect but can’t prove of another more important crime.