ensure that topicUri is not empty before writing a metric