relay_spans/
status_codes.rs

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