implement api for getting statistic.