relay_spans/
status_codes.rs

1use std::collections::BTreeMap;
2use std::sync::LazyLock;
3
4/// HTTP maps some HTTP codes to Sentry's span statuses.
5/// See possible mapping in <https://develop.sentry.dev/sdk/event-payloads/span/>.
6pub static HTTP: LazyLock<BTreeMap<i64, &str>> = LazyLock::new(|| {
7    BTreeMap::from([
8        (400, "failed_precondition"),
9        (401, "unauthenticated"),
10        (403, "permission_denied"),
11        (404, "not_found"),
12        (409, "aborted"),
13        (429, "resource_exhausted"),
14        (499, "cancelled"),
15        (500, "internal_error"),
16        (501, "unimplemented"),
17        (503, "unavailable"),
18        (504, "deadline_exceeded"),
19    ])
20});
21
22/// GRPC maps some GRPC codes to Sentry's span statuses.
23/// See description in grpc documentation.
24pub static GRPC: LazyLock<BTreeMap<i64, &str>> = LazyLock::new(|| {
25    BTreeMap::from([
26        (1, "cancelled"),
27        (2, "unknown_error"),
28        (3, "invalid_argument"),
29        (4, "deadline_exceeded"),
30        (5, "not_found"),
31        (6, "already_exists"),
32        (7, "permission_denied"),
33        (8, "resource_exhausted"),
34        (9, "failed_precondition"),
35        (10, "aborted"),
36        (11, "out_of_range"),
37        (12, "unimplemented"),
38        (13, "internal_error"),
39        (14, "unavailable"),
40        (15, "data_loss"),
41        (16, "unauthenticated"),
42    ])
43});