注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
发一个刚刚结束的店面题目, 其实地理都有但是贴的不完全, 题目不难但是都是花时间在字符串处理了 真真写起来估计要花不少时间 我是没写完。应该挂了
Your goal is to parse a log file and do some analysis on it. The log file contains all requests to a server within a specific timeframe.
You are given the following method/url definitions:
GET /api/users/{user_id}/count_pending_messages
GET /api/users/{user_id}/get_messages
GET /api/users/{user_id}/get_friends_progress
GET /api/users/{user_id}/get_friends_score
POST /api/users/{user_id}
GET /api/users/{user_id}
Where user_id is the id of the user calling the backend.
The script/program should output a small analysis of the sample. It should contain the following information for each of the URLs above:
The number of times the URL was called.
Mean (average) response times (connect time + service time)
Median response times (connect time + service time)
The output should be a JSON string.
The log format is defined as:
{timestamp} {source}[{process}]: at={log_level} method={http_method} path={http_path} host={http_host} fwd={client_ip} dyno={responding_dyno} connect={connection_time}ms service={processing_time}ms status={http_status} bytes={您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 =33
Given the above three log lines, we would expect output like:
{
"request_identifier": "GET /api/users/{user_id}/count_pending_messages",
"called": 3,
"response_time_mean": 17.0,
"response_time_median": 17.0,
"dyno_mode": "web.10"
}
|