Fixed a bug in port mapping metrics.

Review: https://reviews.apache.org/r/23544