Repository navigation
Closed
Labels
area: appsApp Store, app-sdk, MCP apps, app runtimeApp Store, app-sdk, MCP apps, app runtimeenhancementNew feature or requestNew feature or requesttier:T2Small additive feature; existing behaviour unchangedSmall additive feature; existing behaviour unchanged
Description
Existing issues
- I searched open issues and this is not already requested.
Problem
The app usage metrics plan (#38145) has no signal for how long an app's sessions work. Crew records turn duration for every session (kirocrew.turn.duration), but nothing attributes that time to the app that owns the session. So nobody can tell how much agent run time each app, and each version of it, consumes.
Why does this matter? (5 Whys)
- Why add a run time counter? App authors and Crew maintainers cannot see how much work an app's sessions do, so they cannot tell which apps are used heavily or which versions run long turns.
- Why can that not be read from
kirocrew.turn.duration? That histogram has no app label, and turns of an app session cannot be told apart from all other turns. - Why feed it from
emit_turn_durationinsrc/kiro_crew/metrics/turns.py? It is the one boundary that both turn callers share (_emit_turn_metricindashboard/chat_turn/turn_stats.pyand_emit_turn_histogramindashboard/handlers/usage.py), so every surface is counted once per turn and the app time can never exceed all turn time. - Why is this its own change? It is RFC section 11 PR 5 of the app usage metrics plan (docs/request-for-change/rfc-app-usage-metrics.md on branch docs/rfc-app-usage-metrics). RFC PR docs(rfc): propose app usage metrics (installs, versions, sessions, run time) #39107 was closed unmerged; the owner wants the rest shipped as normal PRs. It needs
app_public_version()from RFC PR 3 (feat(metrics): count app updates and uninstalls with the app's public version #39715, merged), and it is independent of the other rows. - Why is it safe to add? The metric schema manifest is append-only, so one new row is an addition and breaks no reader.
Proposed behaviour
- New counter
kirocrew.app.run_time, units, scopekiro.crew, shape("app", None, "app"), so it carriesFeature,ActivityandEntitylike the other app rows. - Attributes beyond those:
Entityis the app's public id,entity_versionis the app's public version, anddurationis the bucket of that one turn:le_10s,le_1m,le_5m,le_15m,le_1h,le_4h,gt_4horother(thele_/gt_spelling ofDURATION_BUCKETSinsrc/kiro_crew/metrics/work.py). emit_turn_durationgains anowning_appargument. Both turn callers,_emit_turn_metricand_emit_turn_histogram, pass the session's trustedowning_appfrom the live provider. Sub-agent turns of an app session carry the sameowning_app, so they count toward the app.- The value added is the turn's wall seconds, rounded up. A turn with no duration adds nothing, because a 0 would read as a measured instant turn.
- A session with no
owning_appadds nothing. The existing turn metric is unchanged. - A recorder that raises must not change the turn metric: the existing
kirocrew.turn.durationand the other turn instruments are still emitted exactly as before. - The new row is added to the metric schema manifest (
python test/metrics_schema_helpers.py --write), and the telemetry docs list it. - Tests: seconds are rounded up; bucket edges (10 s is
le_10s, 11 s isle_1m; 4 h isle_4h, 4 h + 1 s isgt_4h); a turn with no duration adds nothing; both turn callers passowning_app; noowning_appadds nothing; a raising recorder leaves the turn metric unchanged. Existing turn metric tests keep passing.
Alternatives considered
Add an app label to kirocrew.turn.duration. Rejected: the metric schema is append-only and that histogram is read by the Telemetry page, so a new label would split its existing series. A separate counter with the closed app shape is the same choice the other app rows made.
Anything else
No change to what users see. Done when the change is merged with tests and the manifest guard passes. Related: #38145 (umbrella), #39715 (RFC PR 3, merged).
Metadata
Metadata
Assignees
Labels
area: appsApp Store, app-sdk, MCP apps, app runtimeApp Store, app-sdk, MCP apps, app runtimeenhancementNew feature or requestNew feature or requesttier:T2Small additive feature; existing behaviour unchangedSmall additive feature; existing behaviour unchanged
Activity
feat(metrics): count an app's turn seconds as kirocrew.app.run_time
feat(metrics): count an app's turn seconds as kirocrew.app.run_time
feat(metrics): count an app's turn seconds as kirocrew.app.run_time
feat(metrics): count an app's turn seconds as kirocrew.app.run_time
feat(metrics): count an app's turn seconds as kirocrew.app.run_time (k…