Package com.tnsai.observability.errors
One ErrorReport per error
occurrence, dedup-able by stable
ErrorFingerprint, classified by
ErrorCategory, with a flat
CauseInfo chain.
Builders: ErrorEmitter.from(Throwable)
pre-populates everything derivable from the throwable; caller fills
classification + attributes.
Stack-trace normalization
(StackTraceNormalizer) strips
lambda hashes and proxy suffixes so the same code path produces the
same digest across JVM restarts. Fingerprints stay stable across hosts.
Correlation: every report optionally carries the
EventContext that was active at
throw time (tenant / session / agent / role / trace), captured
automatically via AgentContext.
Defensive helper:
TnsAIException.wrap(Throwable) normalizes
arbitrary third-party throwables into the framework's exception hierarchy
with best-effort retryable classification.
Out of scope for this PR (follow-ups):
- Sink layer (
ErrorReportPublisher) — Prometheus metrics, Sentry/Rollbar adapters, Alertmanager rules. - Recovery action tracking integration with
ResilienceExecutor/@Resilience. relatedEventIdspopulated from a session event buffer.- Redaction integration (#80) for messages and stack traces.
- Migration: rewire framework
logger.error(..., e)call sites.
- Since:
- 0.5.0 (issue #86)
-
ClassDescriptionIn-memory
ErrorReportPublisherfor tests.Compact summary of a single throwable in a flattened cause chain.Fan-outErrorReportPublisher— invokes every wrapped publisher for eachCompositeErrorReportPublisher.publish(ErrorReport)call.Decorator that suppresses repeatErrorReports of the sameErrorReport.fingerprint()within a configurable time window.Coarse classification of errors for routing, alerting, and budget tracking.Single emission point forErrorReportconstruction.Deterministic fingerprint for an error instance class.Structured observability record for an error event.Service-side fan-out point forErrorReportemissions.Static facade for publishingErrorReports.DefaultErrorReportPublisher— JSON-serialises the report and writes it via SLF4J at the level matching the report'sErrorCategory.Stack-trace normalization for stable error fingerprinting.