Skip to content

Metrics and error logs fine tune#3045

Merged
abose merged 4 commits into
mainfrom
ai
Jul 27, 2026
Merged

Metrics and error logs fine tune#3045
abose merged 4 commits into
mainfrom
ai

Conversation

@abose

@abose abose commented Jul 27, 2026

Copy link
Copy Markdown
Member

No description provided.

abose added 4 commits July 27, 2026 11:20
… and error reporting

Metrics (audit-map visible, GA name budget <30 chars, serverId sanitized
once as client._metricLabel; language ids used raw):
- lsp.srv.<srv>Start/StartErr/Crash/Gaveup/RstErr/Err/OffBoot/PrefOff -
  server lifecycle and opt-out; pref metrics log only the non-default
  (off) state
- lsp.time.<srv><Comp|Sig|Hover|Def|Ref|Fix|Res|Hlt|Oth|Init> - request
  latency timed once at the _request choke point, successes only
- lsp.hint.<srv>Show/Acc/Import/Fail + sig/def/ref/fix/hover Fail -
  per-server feature funnel; err-vs-empty rejections distinguished
- hints.show/accept/fail/provErr/insErr/sig.<lang>, hints.pref.off/
  sigOff, editor.jump.<lang>Ok/Fail, editor.ref.<lang>Ok/None -
  per-language usage across all providers (acceptance = accept/show)

High-frequency events go through new Metrics.countEventBatched/
valueEventBatched: client-side 2-minute aggregation windows (counts sum,
values average) flushed through the normal pipeline and on flushMetrics.

Error reporting (respects the 2/min app-wide budget):
- logger.reportErrorOnce(key, err, msg) - once per key per run
- reported: server start/restart failure (shared key; was silently
  swallowed in registerLanguageServer), crash give-up with sanitized
  stderr line, provider throw in hint session, insertHint throw
- loggerSetup onError now scrubs path-like substrings from outgoing
  error messages: home prefix cut to ~, known internal/system paths
  kept, everything else redacted; never throws, fails closed
- CodeHintManager hardening: hasHints/getHints/insertHint wrapped so a
  throwing provider can't wedge the session; deferred hints finally get
  a .fail handler (manager-initiated cancels excluded)
- _watchServerPref only acts on real value flips - a same-value pref
  scope event no longer restarts a running server

Also fixes HealthDataManager using undefined Metrics.PLATFORM.

Tests: batched aggregation + getSafeLabel-free schema in Metrics spec;
TS suite gains usage-metrics specs (audit assertions for start/latency/
accept), reportErrorOnce dedup and scrubber specs; JSON suite asserts
PrefOff + restart counts.
… grouping

lsp.time.typescriptComp -> lsp.time.Comp.typescript (same for srv/hint/
sig/def/ref/fix/hover and editor.jump/ref labels) so sorted audit and
analytics views group by operation with the server/language as the
trailing segment.

Also relax the metric count assertions in the JSON/TS specs from exact
+1 to greater-than so incidental server events (crash auto-restart,
scope reload) can't flake them.
UI.toolbarBtn.terminal/appDrawer/extnMgr - one family so toolbar
engagement groups together in analytics. The extension manager metric
lives in ExtensionManagerDialog (the icon's live click handler), not in
the feature-gated Phoenix-extension-store binding.

Also picks up the regenerated Commands.md for the rebased view.enableAI
command doc.
@sonarqubecloud

Copy link
Copy Markdown

@abose
abose merged commit f878a24 into main Jul 27, 2026
12 of 21 checks passed
@abose
abose deleted the ai branch July 27, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant