chore(telemetry): normalize telemetry property keys to snake_case#1196
Merged
Conversation
- Rename camelCase telemetry keys to snake_case on compaction_finished, compaction_failed, micro_compaction_finished, and the tool error event (tokens_before, tokens_after, compacted_count, retry_count, thinking_level, error_type, input_tokens/output_tokens, and the micro compaction config/effect keys). - Emit a fixed client-attribution key set (client_id/name/version/ui_mode, null when absent) from both session_started producers (core-impl and kimi-harness) so they share a stable schema. - Drop the duplicate current/latest keys on update_prompted and the redundant ui_mode on server_started. - Additive fields: login.method=oauth and question_answered.answered. Telemetry-only change; no changeset.
|
commit: |
7Sageer
added a commit
to 7Sageer/kimi-code
that referenced
this pull request
Jun 29, 2026
Resolve conflicts in compaction telemetry: adopt the snake_case telemetry keys from main (MoonshotAI#1196) while keeping this branch's single-round compaction design that retains user messages. 'round' is hard-coded to 1 since this branch compacts in a single round; affected test assertions are updated to match the snake_case keys and this branch's token counts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No linked issue. This is internal telemetry hygiene; the motivation is in the next section.
Problem
Telemetry property keys had drifted into an inconsistent mix of camelCase and
snake_case across events, and a few events carried redundant or sparse fields:
compaction_finished/compaction_failedandmicro_compaction_finishedused camelCase (
tokensBefore,compactedCount,retryCount, …) while therest of the telemetry surface (
subagent_name,run_in_background,duration_ms, …) is snake_case.update_promptedemitted bothcurrent/latestandcurrent_version/target_versionfor the same values.session_startedwas a sparse key set (empty fieldsomitted), so the two producers (daemon
core-impland single-processkimi-harness) could emit differently-shaped events.Telemetry is untyped (
TelemetryProperties = Record<string, …>), so none ofthis is caught by the compiler; the contract lives in the downstream consumers.
Keeping the key schema consistent and stable is what makes those consumers
tractable.
What changed
(
tokens_before,tokens_after,compacted_count,retry_count,thinking_level,error_type,input_tokens/output_tokens, and themicro-compaction config / effect keys).
client_id/client_name/client_version/ui_mode,nullwhen the client did not provide a field)from both
session_startedproducers so they share one schema.current/latestkeys onupdate_promptedand theredundant
ui_modeonserver_started(the server's boot UI mode is nowcovered by the client-attribution
ui_mode).loginnow carriesmethod: 'oauth'(matching the existingmethod: 'api_key'path), andquestion_answeredcarries anansweredcount.
A few fields changed shape, not just name, worth flagging explicitly:
compaction_finishedno longer emits the custominstruction, and theper-component token breakdown (
inputCacheRead/inputCacheCreation) wasfolded into a single
input_tokens(=inputTotal).video_uploaderror event moved fromerror(full message) toerror_type(error class name), matching the convention already used bycrash,api_error, andcompaction_failed(low-cardinality type ontelemetry; the message stays on hooks / logs).
The persisted
apply_compactionrecord fields (CompactionResult.tokensBeforeetc.) are intentionally left camelCase — they are consumed by external
projectors and are a separate channel from telemetry.
Compatibility
This renames and remaps telemetry property keys that downstream dashboards and
alerts may reference. Producers and consumers should be coordinated before this
lands.
Checklist
gen-changesetsskill, or this PR needs no changeset. (Telemetry-only change — no changeset.)gen-docsskill, or this PR needs no doc update. (Internal telemetry schema — no user-facing docs to update.)