Skip to content

Create a standardized error classification system that maps exceptions to semantic error types for consistent error reporting in traces #475

Closed as not planned

Description

@psschwei

Description:
Create a standardized error classification system that maps exceptions to semantic error types for consistent error reporting in traces.

Detailed Requirements:

  1. Define semantic error types in mellea/telemetry/errors.py:
    • rate_limit - Rate limiting errors
    • timeout - Request timeouts
    • content_policy - Content policy violations
    • auth - Authentication errors
    • invalid_request - Bad request errors
    • transport_error - Network errors
    • server_error - Provider server errors
    • validation_error - Mellea validation failures
    • tool_error - Tool execution errors
  2. Create exception classifier:
    • classify_exception(exception) -> ErrorType
    • Handle provider-specific exceptions (OpenAI, Anthropic, etc.)
  3. Create helper for setting span status:
    • set_semantic_error(span, exception) - Sets status and error attributes
  4. Integrate with existing set_span_error() function
  5. Add error.type span attribute with semantic type

Files to Create:

  • mellea/telemetry/errors.py

Files to Modify:

  • mellea/telemetry/__init__.py - Export error utilities
  • mellea/telemetry/backend_instrumentation.py - Use semantic errors

Error Type Attributes:

Attribute Description
error.type Semantic error category
error.message Exception message
exception.type Python exception class name

Acceptance Criteria:

  • All common exceptions mapped to semantic types
  • Span status correctly set on errors
  • Error type attribute added to spans
  • Provider-specific exceptions handled

Activity

  1. ajbozarth commented on May 8, 2026

    @ajbozarth
    Member

    Closing as part of the tracing epic (#444) re-plan. This sub-issue predates the plugin/hooks pattern (PR #653) and the GenerationMetadata partition (PR #908); its spec has drifted.

    The metrics epic (issue #465) already built a matching error taxonomy (classify_error + 8 ERROR_TYPE_* constants in mellea/telemetry/metrics_plugins.py), so rather than create a parallel module the refreshed plan reuses it.

    Replacement: split across #1053 (share metrics' classify_error with tracing plugins) and #1047 (wire the semantic error category onto spans via a generation_error plugin hook).

    See #444 for the full refreshed plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions