Update: I was able to figure this out on my own. The problem was that I assumed the $\phi$ coordinate runs from $0$ to $2\pi$, but the metric so defined has a conical singularity. To eliminate the conical singularity, $\phi$ must run from 0 to $2\pi(1+B^2)$. Including this factor in the Gauss-Bonnet formula makes everything work out. Neat.
Trying to learn some geometry, I would like to understand how the Gauss-Bonnet theorem works for a simple surface, a 2-sphere with metric
$f(\theta) d\theta^2 + f(\theta)^{-1} \sin^2\theta d\phi^2$,
where
$f(\theta)=1+B^2 \cos(\theta)^2$
and $B$ is a parameter (a real number between 0 and 1, say).
When I compute the Gaussian curvature, $K$, I find that it depends on $B$. But the area element, $dA=\sqrt{g}d\theta d\phi = \sin\theta d\theta d\phi$ is independent of $B$. So $\int K dA$ depends on $B$. But this can't be right, because Gauss-Bonnet says $\int K dA=4\pi$ is a constant. I must be missing something basic... I need a hint!