Error Logging
Every failure your code logs is one OpenTelemetry log record of a fixed shape, so failures are counted, grouped and followed to their trace without reading their text.
The record
Section titled “The record”| Field | Holds |
|---|---|
| Severity | ERROR, or FATAL for a failure that ends the process |
| Body | A short sentence naming what failed, such as settling the order failed |
error.kind | The failure’s stable kebab-case code |
vantacloud.operation | The operation the failure ended or interrupted, named as Telemetry Conventions names operations |
| Trace context | The trace id and span id of the span the failure happened under, which the OpenTelemetry SDK sets when the record is emitted inside that span |
exception.message | The failure’s message, rendered with its causes |
exception.stacktrace | The stack, where the language offers one |
exception.type | The language’s type of the failure, where it has one |
The message and the stack are attributes of their own and never the body, so the body stays the same for every occurrence of one failure and groups them. The record follows the content rule of the conventions: a message names a value a person sent by its id, never the value itself.
Choosing the kind
Section titled “Choosing the kind”error.kind names the failure apart from its message, so two failures with
different causes have different kinds and one failure has one kind wherever
it occurs. Take it from the code your error type already carries. A Rust
service whose errors carry a code takes that code, such as not-found,
conflict, unavailable or permission-denied, or the kebab-case name of
the error’s variant. In another language, give each failure your code
distinguishes a kebab-case name and keep it stable across releases.
Use one of these common kinds wherever it fits, and a kind of your own for
every other failure: invalid-argument, not-found, conflict, refused,
unavailable, limit-exceeded, io-error, permission-denied and
other, for a failure your code cannot classify.
Where errors are read
Section titled “Where errors are read”Your errors are counted per service and kind, so the default dashboard draws
the errors of each kind of each service over time, and an error rate alert
counts operations whose outcome class is server-error. A record’s trace
context leads from the error to every span of the request it ended.