iPhone crash管理

# 背景

* 每日线上会收集回来很多的崩溃信息,但我们往往关心的是有多少类,及该类崩溃信息对应的系统、硬件分布、崩溃pv、uv等情况

* 版本间崩溃对比,top20问题是否有变动,历史版本崩溃是否被修复,线上版本是否有新增崩溃

# 分析崩溃

### 第一步、符号化崩溃日志

### 第二步、获取单个崩溃日志的各项信息

* 获取崩溃线程,然后对线程信息做处理得出崩溃唯一标识

```

# 这块暂时不做容错,默认crash均是完整

lastExceptionBacktrace = re.search(r"Last Exception Backtrace:(.+?)Thread ", c_content, re.S)

if lastExceptionBacktrace:

crash_info["crash_thread_detial"] = lastExceptionBacktrace.group(1).strip()

else:

try:

crash_info["crash_thread_detial"] = re.search(r'Crashed:(.+?)Thread ',c_content ,re.S).group(1).strip()

except:

print "no Crashed word:",crashPath

return None

```

* 获取系统版本

`crash_info["os_version"] = re.search(r"OS Version:(.+)", c_content).group(1).strip()`

* 获取设备硬件信息

- `crash_info["hardware"] = re.search(r"Hardware Model:(.+)", c_content).group(1).strip()`

- 一般需要做一个映射关系

```

INTERNAL_NAME = {

# iPhone 映射关系

"iPhone1,1": "iPhone",

"iPhone1,2": "iPhone 3G",

"iPhone2,1": "iPhone 3GS",

"iPhone3,1": "iPhone 4",

"iPhone3,2": "iPhone 4",

"iPhone3,3": "iPhone 4",

"iPhone4,1": "iPhone 4S",

"iPhone5,1": "iPhone 5",

"iPhone5,2": "iPhone 5",

"iPhone5,3": "iPhone 5c",

"iPhone5,4": "iPhone 5c",

"iPhone6,1": "iPhone 5s",

"iPhone6,2": "iPhone 5s",

"iPhone7,2": "iPhone 6",

"iPhone7,1": "iPhone 6 Plus",

"iPhone8,1": "iPhone 6s",

"iPhone8,2": "iPhone 6s Plus",

# iPad 映射关系

"iPad1,1": "iPad",

"iPad2,1": "iPad 2",

"iPad2,2": "iPad 2",

"iPad2,3": "iPad 2",

"iPad2,4": "iPad 2",

"iPad3,1": "iPad 3",

"iPad3,2": "iPad 3",

"iPad3,3": "iPad 3",

"iPad3,4": "iPad 4",

"iPad3,5": "iPad 4",

"iPad3,6": "iPad 4",

"iPad4,1": "iPad Air",

"iPad4,2": "iPad Air",

"iPad4,3": "iPad Air",

"iPad5,3": "iPad Air 2",

"iPad5,4": "iPad Air 2",

"iPad6,7": "iPad Pro",

"iPad6,8": "iPad Pro"

}

```

* 获取app版本

`crash_info["app_version"] = re.search(r"Version:(.+)", c_content).group(1).strip()`

### 第三步、根据上述获取到的信息做聚类即可

你可能感兴趣的:(iPhone crash管理)