Skip to content

Fix telemetry "Unknown" errors: wrap string exceptions, add missing instrumentation, and catch-all decorato - #53

Merged
ashnanze merged 6 commits into
mainfrom
ashlee/fix-unknown-telemetry
Jul 2, 2026
Merged

Fix telemetry "Unknown" errors: wrap string exceptions, add missing instrumentation, and catch-all decorato#53
ashnanze merged 6 commits into
mainfrom
ashlee/fix-unknown-telemetry

Conversation

@ashnanze

@ashnanze ashnanze commented Jun 24, 2026

Copy link
Copy Markdown

Problem

The "Arc K8s Agent Activity" telemetry dashboard shows "Unknown" as a top error category due to three root causes:

  1. ExceptionName = "str"telemetry.set_exception(exception="some string", ...) records the type name str instead of a meaningful exception class name.
  2. FinalState = Unknown — Several raise statements had no preceding telemetry.set_exception() call, so the CLI framework logged a failure with no fault context.
  3. ErrorType = UnknownError — Unhandled AzureException subclasses that bypass our telemetry instrumentation get classified as UnknownError by the CLI framework's default handler.

Fix

1. Wrap string exception= arguments in Exception() (~27 instances)

Across custom.py, _utils.py, and _precheckutils.py, changed:

telemetry.set_exception(exception="some message", ...)

@github-actions

Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

…d catch-all decorator

- Replace all exception='string' calls with exception=Exception('string') across
  custom.py, _utils.py, and _precheckutils.py so that ExceptionName in telemetry
  shows 'Exception' instead of 'str'
- Add _telemetry_catch_all decorator to top-level command functions
  (create, delete, update, upgrade) to catch unhandled exceptions, log them
  to telemetry with proper ExceptionName/FaultType, and re-raise as
  CLIInternalError instead of letting them become 'UnknownError'
@ashnanze ashnanze changed the title adding telemetry updates to update unknown Fix telemetry "Unknown" errors: wrap string exceptions, add missing instrumentation, and catch-all decorato Jun 30, 2026
@ashnanze
ashnanze requested a review from jianyunt as a code owner July 1, 2026 18:20
@ashnanze
ashnanze merged commit adb149e into main Jul 2, 2026
4 of 8 checks passed
@ashnanze
ashnanze deleted the ashlee/fix-unknown-telemetry branch July 2, 2026 18:01
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.

3 participants