Added withEndpoint to allow setting the CloudWatch region-specific endpoint
Filter out Double.NaN, since CloudWatch doesn't like it