feat: 启动监控维度字段 is_first_install 对齐为 app_install_status

- LaunchMonitor:维度字段改为 app_install_status(normal/new_install/over_written 三值),getAppInstallStatus() 以 StartManager 布尔值映射两值,over_written 待完整 workspace 对齐;分桶指标维度名与 record 同步
- demo LaunchDiagnostics 同步:appInstallStatus 以 preferences 自实现(无记录→new_install,有记录→normal),展示与类头注释更新,over_written 无法区分已注明
- 真机验证:首启 app_install_status=new_install,二次启动=normal

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
clz
2026-08-06 14:51:39 +08:00
co-authored by Claude
parent 96d6f1b34e
commit 96f183c2c0
2 changed files with 23 additions and 17 deletions
@@ -190,7 +190,7 @@ export class LaunchMonitor {
start_type: startType,
entry_page: isBackfillEvent ? 'unknown' : LaunchMonitor.capturedEntryPage,
app_version: LaunchMonitor.getAppVersion(),
is_first_install: LaunchMonitor.getIsFirstInstall(),
app_install_status: LaunchMonitor.getAppInstallStatus(),
response_latency: responseLatency,
animation_finish_time: animationFinishTime,
startability_processstart_dur: startabilityProcessStartDur,
@@ -216,7 +216,7 @@ export class LaunchMonitor {
monitor.setDimension_1(startType.toString())
monitor.setDimension_2(isBackfillEvent ? 'unknown' : LaunchMonitor.capturedEntryPage)
monitor.setDimension_3(LaunchMonitor.getAppVersion())
monitor.setDimension_4(LaunchMonitor.getIsFirstInstall().toString())
monitor.setDimension_4(LaunchMonitor.getAppInstallStatus())
monitor.record(coldStartTime)
HXLog.i(TAG, `Cold start bucket metric recorded: ${coldStartTime}ms`)
} catch (e) {
@@ -238,7 +238,7 @@ export class LaunchMonitor {
builder.setDimension1Name('start_type')
builder.setDimension2Name('entry_page')
builder.setDimension3Name('app_version')
builder.setDimension4Name('is_first_install')
builder.setDimension4Name('app_install_status')
builder.setBuckets([500, 600, 700, 800, 1000, 1500, 2000, 3000])
HXEventMonitor.getEventFactory('launch').create(builder)
LaunchMonitor.bucketMetricInitialized = true
@@ -259,9 +259,13 @@ export class LaunchMonitor {
return GIT_COMMIT
}
/** 维度:是否安装后首次进入(StartManager 在 EntryAbility.onCreate 中已 init) */
private static getIsFirstInstall(): boolean {
return StartManager.getInstance().getAppInstallStatus()
/**
* 维度:安装状态(normal/new_install/over_written)。
* 真实实现取三值安装来源;当前以 StartManager 布尔值映射(true→new_install,false→normal),
* over_written 需安装来源信息,待完整 workspace 对齐。
*/
private static getAppInstallStatus(): string {
return StartManager.getInstance().getAppInstallStatus() ? 'new_install' : 'normal'
}
}
@@ -285,8 +289,9 @@ interface ColdStartMetricPayload {
entry_page: string
// 维度:应用内部版本号
app_version: string
// 维度:是否安装后首次启动(首次启动耗时显著偏高,需从常规分布中区分)
is_first_install: boolean
// 维度:安装状态(normal 常规 / new_install 全新安装 / over_written 覆盖安装),
// 首启耗时显著偏高,需从常规分布中区分
app_install_status: string
// 系统响应段:离手到动效开始耗时(ms,需 API 22+)
response_latency: number
// 系统动效段:动效完成耗时(ms)