Package com.tnsai.observability.errors
Class ErrorFingerprint
java.lang.Object
com.tnsai.observability.errors.ErrorFingerprint
Deterministic fingerprint for an error instance class.
Two errors with the same fingerprint are treated as the same bug for purposes of dedup, alerting, and dashboards. This is the analogue of Sentry/Rollbar/Datadog "issue grouping" — without a stable fingerprint the same bug from 1000 concurrent users becomes 1000 separate alerts.
Fingerprint inputs
- errorClass — fully-qualified throwable type
- errorCode — TNSAI-XXX (when present); two errors with the same stack but different codes are distinct bugs
- stackTraceDigest — from
StackTraceNormalizer.digest(Throwable) - relevantAttributes — caller-selected, low-cardinality fields (e.g. provider/model for LLM errors, tool name for tool errors). Per-request data MUST NOT be passed here or every request gets its own fingerprint and dedup collapses.
Output: a 16-hex-char SHA-256 prefix (64 bits). Same input → same output across JVM restarts and across hosts (no thread-local state, no timestamps, no PID, no random seed).
- Since:
- 0.5.0 (issue #86)
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringof(String errorClass, String errorCode, String stackTraceDigest, Map<String, String> relevantAttributes) Compute the fingerprint from already-prepared inputs.static StringConvenience: derivestackTraceDigestfrom the throwable's normalized stack viaStackTraceNormalizer.
-
Method Details
-
of
public static String of(String errorClass, String errorCode, String stackTraceDigest, Map<String, String> relevantAttributes) Compute the fingerprint from already-prepared inputs.- Parameters:
errorClass- fully-qualified throwable class name; requirederrorCode- framework error code (TNSAI-XXX) or null/blank if nonestackTraceDigest- fromStackTraceNormalizer.digest(Throwable); requiredrelevantAttributes- low-cardinality contextual attributes; null treated as empty- Returns:
- 16-character lowercase hex string
-
of
Convenience: derivestackTraceDigestfrom the throwable's normalized stack viaStackTraceNormalizer.
-