错误、会话和用户
把控制台的 Errors、Sessions、People、Releases、Insights 和 Usage 页面做成命令。
这些命令显示的内容与控制台各页面相同。除了 usage,每条命令都作用于一个项目,并接受
lyrelog events 的筛选和时间参数:--level、--attr、--version、--platform、
--env、--since、--from、--to 等等。如果不另行指定,时间窗口为最近 7 天。
示例中的项目把用户称为 players。工具会使用每个项目自己的称呼(参见 Project settings)。
错误
lyrelog errors(或 lyrelog issues)对应 Errors 页面:按分类和事件名归组的 error 和 critical 事件,
最严重的排在最前。每一行显示发生次数、与上一个时间窗口相比的变化、影响了多少用户、最后一次出现的时间、出现在哪些版本上,以及变化趋势。
lyrelog errorsTilefall · production · last 7 days
Event Area Count Change Players Last seen Versions Trend
● cloud_save_failed sync 823 new 124 7m ago 1.6.3 ▄▇▁▄▇▂▅▇▁▃▇▂▄▇▂▄▇▁▄█▂▁
● daily_upload_failed daily 178 new 124 32m ago 2.0, 1.6.3 ▄▄ ▃▅ ▃▇▂▃█▂▄▇▁▄▄▂▂▅▂▂
● match_update_denied multiplayer 43 new 38 38m ago 2.0, 1.6.3 ▂▇ ▄▅ ▂▂ █▂▄▅█▂▄▇ ▅▇ ▂
● chat_socket_gave_up chat 28 new 28 20m ago 2.0, 1.6.3 ▃▃ ▆█▃ █ ▆▆ ▆▆▃▃▃ ▃█ ▆
● leaderboard_submit_fa… leaderboards 29 new 17 1d ago 2.0, 1.6.3 █
● database_open_failed app 17 new 16 26m ago 2.0, 1.6.3 ▃▃▆▃ ▃ ▃▃ ▃▃▆▃ █ ▃
● purchase_failed purchases 9 new 8 12h ago 2.0, 1.6.3 ▄ █ █ ▄ ▄▄ ▄| 参数 | 作用 |
|---|---|
--warnings | 把 warning 也计算在内 |
lyrelog errors --since 24h --warnings
lyrelog errors --version 2.4.1 --json | jq '.[0]'在 JSON 中,每个问题都带有 sample_event、sample_user 和 sample_session,可以直接交给
lyrelog events get、lyrelog person 和 lyrelog events --session 使用。
会话
lyrelog sessions 对应 Sessions 页面:谁、多长时间、多少事件和错误、设备和版本,以及第一个和最后一个事件
(如果有错误,还会显示第一个错误)。
lyrelog sessions --with-event purchase_failed --sort longestTilefall · production · last 7 days
Started Player Length Events Errors Device Version From → to Session
3d ago pl-3860c35c 37m 21s 34 1 iPad14,1 2.0 app_launch → app_background ✗ purchase_fai… cfc2523d-c1a3-4b4f-b576-53d98d2826e1
12h ago pl-6405980a 28m 15s 24 1 iPhone17,1 1.6.3 app_launch → app_background ✗ purchase_fai… e567122a-70f9-42de-9f5b-f088684aa0a2
1d ago pl-dcb099d1 23m 23s 25 1 iPhone18,1 2.0 app_launch → app_background ✗ purchase_fai… c8c02c07-0f64-4d20-9575-835f2758432f| 参数 | 作用 |
|---|---|
--errors | 只显示有错误的会话 |
--with-event | 只显示包含该事件(message)的会话 |
--min-duration | 只显示时长至少为此值的会话:30s、5m |
--sort | recent(默认)、longest、errors 或 events |
--page | 页码,每页 50 个会话,从 0 开始 |
要按顺序阅读某个会话的事件,把它的 id(JSON 中的 sid 字段)传给 lyrelog events --session <id> --oldest-first。
用户
lyrelog people 对应 People 页面:在时间窗口内使用过应用的用户,以及他们的事件数、会话数、错误数,
和最近一次使用的设备与版本。它也可以写作 lyrelog users 和 lyrelog players。
lyrelog people --sort errorsTilefall · production · last 7 days
Player Events Sessions Errors Last seen First seen Device Version OS Country
pl-4e5d999b 553 30 24 1h ago 6d ago iPhone18,2 1.6.3 iOS 27.0.3 ES
pl-eb2cd82f 455 27 24 7h ago 6d ago iPad16,6 1.6.3 iOS 27.2.0 IT
pl-519465f0 443 27 20 11h ago 6d ago iPad14,1 1.6.3 iOS 27.0.3 FR
50 of 300 players. Next: --page 1| 参数 | 作用 |
|---|---|
--search | 以此开头的 id |
--sort | last_seen(默认)、events、errors、sessions 或 first_seen |
--page | 页码,每页 50 个用户,从 0 开始 |
单个用户
lyrelog person <user-id>(或 user、player)对应单个用户的页面:事件总数、最近的会话和最新的事件。
id 是应用发送的 user_id,精确匹配。
lyrelog person pl-fe0958c6 -n 4Player pl-fe0958c6 in Tilefall
290 events in all, first 6d ago, last 8m ago
Sessions last 7 days
Started Length Events Errors Device Version From → to Session
8m ago 40s 5 1 iPhone18,2 1.6.3 app_launch → app_background ✗ cloud_save_failed 51e19a18-ca3e-4428-a10b-baeadc7eaaf8
2h ago 23m 58s 23 1 iPhone18,2 1.6.3 app_launch → app_background ✗ cloud_save_failed 2f396cf7-4741-4102-acba-abe64fe9b31e
12h ago 20m 38s 19 0 iPhone18,2 1.6.3 app_launch → app_background 5e9f9fee-7158-4ed1-87eb-46c6585d658e
Latest events
10:30:36 ▌info app_background app seconds_open=11
10:30:07 ▌error cloud_save_failed sync reason=schema_mismatch record=progress status=422
10:29:58 ▌info sign_in_completed account latency_ms=641 method=apple
10:29:57 ▌debug api_request network latency_ms=187 path=/app-version status=200
Everything of theirs: lyrelog events --user pl-fe0958c6 --since 7d| 参数 | 作用 |
|---|---|
-n、--limit | 显示多少个最近的事件。默认 20。 |
--since、--from、--to | 会话和事件的时间窗口。默认 7d。 |
--env、--platform | 与 events 中相同 |
--export <file> | 把该用户的所有事件以 JSON lines 格式写入该文件,- 表示输出到 stdout |
--delete | 删除该用户的所有事件(仅限所有者;无法撤销) |
-y、--yes | 与 --delete 一起使用:不要求确认 |
隐私请求
这些就是控制台中 A person's data(单个用户的数据)的工具(参见隐私请求):
lyrelog person pl-fe0958c6 --export pl-fe0958c6.ndjson # an access request (any member)
lyrelog person pl-fe0958c6 --export - | jq .message
lyrelog person pl-fe0958c6 --delete # an erasure request (owners)--delete 会要求你输入该用户的 id 以确认。在 JSON 模式下没有人能回答,所以需要加上 --yes。
版本
lyrelog releases(或 lyrelog versions)对应 Releases 页面:每个应用版本的用户数、会话数、
无错误会话的占比、错误数和 critical 事件数,以及首次和最后一次出现的时间。
lyrelog releasesTilefall · production · last 7 days
Version Players Sessions Without errors Errors Critical First seen Last seen
2.0 171 1,849 90% 194 13 6d ago 10m ago
1.6.3 129 1,353 36% 933 4 6d ago 7m ago洞察
lyrelog insights 对应 Insights 页面:某件事发生的频率(trend)、失败的频率(rate),
以及用户在一个流程中能走多远(funnel)。
insights trend
一个或多个事件随时间发生的频率,可以按维度拆分。
lyrelog insights trend game_won --by versionTilefall · production · last 7 days
Event Group Events Over time
game_won 2.0 1,552 ████▇▇▆▂
game_won 1.6.3 1,098 ▇██████▂lyrelog insights trend game_won --metric users --since 30d
lyrelog insights trend game_won --metric value --value-path seconds --stat p90| 参数 | 作用 |
|---|---|
--by | 按 version、country 或 attr:<path> 拆分 |
--metric | events(默认)、users(用户),或 value(一个数值属性) |
--value-path | 与 --metric value 一起使用:存放数值的属性 |
--stat | 与 --metric value 一起使用:avg、p50、p90、p95、p99 或 max |
lyrelog events attributes --numeric 会列出存放数值的属性。
insights rate
一组事件占另一组事件的比例:失败次数除以尝试次数。
lyrelog insights rate --hits purchase_failed --of "purchase_started|purchase_failed"Tilefall · production · last 7 days
Event Rate Hits / tries Over time
purchase_failed of purchase_started, purchase_failed 10.59% 9 / 85 ▁▅██▅▇▅▁| 参数 | 作用 |
|---|---|
--hits | 被计数的事件(失败):"a|b" |
--of | 作为分母的事件(尝试):"c|d" |
--by | 按 version、country 或 attr:<path> 拆分 |
insights funnel
有多少用户按顺序到达流程的每一步,以及每一步花了多长时间。需要给出两个或更多事件。
lyrelog insights funnel app_launch game_started game_won --window 1hTilefall · production · last 7 days · within 1h
Step Players Of the first Median time
1. app_launch ████████████████████ 300 100%
2. game_started ███████████████████░ 291 97% 6m 56s
3. game_won ███████████████████░ 288 96% 5m 57s| 参数 | 作用 |
|---|---|
--window | 从第一步到最后一步允许的时间。默认 1d。 |
已保存的视图
lyrelog insights views 列出项目已保存的视图。lyrelog insights delete-view <id> 删除其中一个;它会先询问,
在 JSON 模式下需要 --yes。
用量
lyrelog usage 显示你所属的每个组织本月的事件数与套餐额度的对比,以及这些事件在各项目之间的分布(参见套餐与用量)。
lyrelog usageAlex Rivera · Free plan
██░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 5.3%
52,925 of 1,000,000 events a month · counts start again on Dec 1
█ per day
Project Events Share
Tilefall 52,925 100%| 参数 | 作用 |
|---|---|
--org | 某一个组织,按 id 或名称指定。默认:你所属的全部组织。 |