def get_index_daily_service_line(): service_name = request.args.get('service_name') index_key_list = request.args.get('index_key_list', '') if index_key_list == "": index_name = request.args.get('index_name') days = util.latest_days(10) l = map(lambda x: "%s_%s" % (x, index_name) , days) index_key_list = ";".join(l) url = "http://%s:%d/get_index_serviceprofile?service_name=%s&index_key_list=%s" % \ (config.GATEWAY_HOST, config.GATEWAY_PORT, service_name, index_key_list) print "%s\n" % url data = util.request_http_json(url) (name, key_list, value_list) = util.parse_daily_index(data) key_list = map(lambda x: "'%s-%s'" % (x[4:6], x[6:8]), key_list) lineName = name title=u"服务每日指标统计 -- %s" % (lineName) subtitle = u"service:%s" % (service_name) xTitle = u"日期/MMDD" yTitle = u"数量/个" content = render_template('get_index_line.html', \ title = title, subtitle = subtitle,\ xTitle = xTitle, yTitle = yTitle, \ lineName = lineName, \ key_list = ",".join(key_list), \ value_list = ",".join(value_list), \ objs=None) resp = make_response(content, 200) resp.headers['Content-type'] = 'text/html; charset=utf-8' return resp
def get_index_daily_users_lines(): username_list = request.args.get('username_list').split(";") service_name = request.args.get('service_name') index_key_list = request.args.get('index_key_list', '') if index_key_list == "": index_name = request.args.get('index_name') days = util.latest_days(10) l = map(lambda x: "%s_%s" % (x, index_name) , days) index_key_list = ";".join(l) lineName_list = [] value_lists = [] for username in username_list: url = "http://%s:%d/get_index_userprofile?username=%s&service_name=%s&index_key_list=%s" % \ (config.GATEWAY_HOST, config.GATEWAY_PORT, username, service_name, index_key_list) print "%s\n" % url data = util.request_http_json(url) (name, key_list, value_list) = util.parse_daily_index(data) key_list = map(lambda x: "'%s-%s'" % (x[4:6], x[6:8]), key_list) value_lists.append(",".join(value_list)) facename= util.username_to_facename(username, service_name) if facename != config.EMPTY_FACENAME: lineName_list.append(facename) else: lineName_list.append(username) title=u"若干用户每日指标统计 -- %s" % (name) # facename= util.username_to_facename(username, service_name) # if facename != config.EMPTY_FACENAME: # subtitle = "facename:%s" % (facename) # else: # subtitle = "username:%s" % (username) subtitle = "" xTitle = u"日期/MMDD" yTitle = u"数量/个" content = render_template('get_index_lines.html', \ title = title, subtitle = subtitle,\ xTitle = xTitle, yTitle = yTitle, \ lineName_list = lineName_list, \ key_list = ",".join(key_list), \ line_count = len(lineName_list),\ value_lists = value_lists, \ objs=None) resp = make_response(content, 200) resp.headers['Content-type'] = 'text/html; charset=utf-8' return resp