Skip to content

Fix: telemetry decorator wiring - #442

Merged
satyakigh merged 5 commits into
mainfrom
fix/telemetry-decorator-wiring
Feb 13, 2026
Merged

Fix: telemetry decorator wiring#442
satyakigh merged 5 commits into
mainfrom
fix/telemetry-decorator-wiring

Conversation

@kddejong

Copy link
Copy Markdown
Collaborator

Improve telemetry accuracy and troubleshooting capabilities

This PR improves telemetry metrics to better distinguish between service availability issues and infrastructure/developer
issues, while adding rich error attributes for troubleshooting.

Changes

Telemetry Decorator Wiring

  • Fixed DiagnosticCoordinator and PyodideWorkerManager to use @telemetry() decorator instead of manual ScopedTelemetry instantiation
  • Ensures consistent telemetry initialization across all services

Availability Metrics Accuracy

  • Added errorType classification to lint.error and validate.error metrics
  • Infrastructure errors (worker crashes, uninitialized worker, mount failures) are counted with distinct errorType values
  • Parse errors excluded from Guard validate.error (tracked separately as parser.error)
  • Infrastructure issues also tracked separately: worker.crash, init.fault, mount.fault
  • Enables CloudWatch dashboards to filter on errorType attribute to distinguish:
    • cfn-lint availability: lint.error where errorType NOT IN ('WorkerCrash', 'WorkerNotInitialized', 'MountError')
    • Infrastructure health: worker.crash, init.fault, mount.fault, or filter lint.error by infrastructure errorTypes
    • User impact: All lint.error regardless of errorType

Mount Error Handling

  • Added MountError class for proper error classification
  • Non-GitSync files automatically fall back to standalone linting when mount fails
  • Mount failures tracked as mount.fault with errorType attribute
  • Improves resilience while maintaining visibility into mount issues

Error Attributes for Troubleshooting

  • All error metrics now use telemetry.error() with captureErrorAttributes: true
  • Captures secure metadata without exposing user data:
    • error.type: Error class name
    • error.origin: Where it originated
    • errorType: Semantic classification (WorkerCrash, Timeout, PythonError, etc.)
    • Stack location: File and line number
  • Applies to: init.fault, lint.error, mount.fault, validate.error, parser.error, wasm.error, memory.threshold.exceeded,
    rules.load.error

Testing

  • Updated test expectations for MountError message format
  • All existing tests pass

Metrics Impact

This PR maintains backward compatibility for metric names but adds attributes that enable better filtering and analysis
in CloudWatch dashboards.

…orkerManager

Wire telemetry correctly using the @telemetry() decorator instead of
manual ScopedTelemetry instantiation to match the pattern used in
CfnLintService and GuardService.
Infrastructure failures (worker crashes, uninitialized worker) are
tracked separately and should not count against cfn-lint availability.
Only actual cfn-lint failures should impact availability metrics.
Mount failures are infrastructure issues tracked separately as mount.fault
and should not count against cfn-lint availability. Added MountError class
to properly classify and exclude these from lint.error metrics.
When mounting fails for non-GitSync files, fall back to linting by content
instead of failing the lint request. This improves resilience while still
tracking mount failures separately.
@kddejong
kddejong requested a review from a team as a code owner February 13, 2026 19:27
Use telemetry.error with captureErrorAttributes for all error metrics
to capture error type, location from stack trace, and other metadata
while keeping user data secure. This provides better troubleshooting
information for:
- cfn-lint: init.fault, lint.error, mount.fault
- pyodide: init faults (pyodide, pypi, wheels)
- guard: validate.error, parser.error, wasm.error, memory errors, rules.load.error
@kddejong
kddejong force-pushed the fix/telemetry-decorator-wiring branch from 14b9cf3 to c3e0aeb Compare February 13, 2026 20:07
@satyakigh
satyakigh merged commit 3fde9a9 into main Feb 13, 2026
16 checks passed
@satyakigh
satyakigh deleted the fix/telemetry-decorator-wiring branch February 13, 2026 20:20
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.

2 participants