1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
use relay_protocol::{Annotated, Empty, FromValue, IntoValue};

use crate::processor::ProcessValue;

/// Metrics captured during event ingestion and processing.
///
/// These values are collected in Relay and Sentry and finally persisted into the event payload. A
/// value of `0` is equivalent to N/A and should not be considered in aggregations and analysis.
#[derive(Clone, Debug, Default, Empty, PartialEq, FromValue, IntoValue)]
pub struct Metrics {
    /// The size of the original event payload ingested into Sentry.
    ///
    /// The size is measured after applying all content- and transfer-encodings  and thus
    /// independent of compression over the wire.
    ///
    /// For security reports, this is the size of the JSON request sent by the browser and not of
    /// the event payload we extract from it. For ingested envelopes, this is only the size of the
    /// "event" item.
    ///
    /// This metric is measured in Relay during ingestion.
    #[metastructure(field = "bytes.ingested.event")]
    pub bytes_ingested_event: Annotated<u64>,

    /// The size of the minidump ingested into Sentry.
    ///
    /// The size is measured after applying all content- and transfer-encodings  and thus
    /// independent of compression over the wire.
    ///
    /// This metric is measured in Relay during ingestion.
    #[metastructure(field = "bytes.ingested.event.minidump")]
    pub bytes_ingested_event_minidump: Annotated<u64>,

    /// The size of an apple crash report ingested into Sentry.
    ///
    /// The size is measured after applying all content- and transfer-encodings  and thus
    /// independent of compression over the wire.
    ///
    /// This metric is measured in Relay during ingestion.
    #[metastructure(field = "bytes.ingested.event.applecrashreport")]
    pub bytes_ingested_event_applecrashreport: Annotated<u64>,

    /// The cumulative size of all additional attachments ingested into Sentry.
    ///
    /// This is a sum of all all generic attachment payloads (excluding headers). These attachments
    /// are never processed and only potentially stored. Minidumps and apple crash reports are
    /// counted separately in their respective metrics.
    ///
    /// This metric is measured in Relay during ingestion.
    #[metastructure(field = "bytes.ingested.event.attachment")]
    pub bytes_ingested_event_attachment: Annotated<u64>,

    /// The size of the event payload as it is saved in node store.
    ///
    /// For security reports, this is the size of the event derived from the original JSON. For
    /// processed events, such as native or javascript, this includes information derived during
    /// symbolication and internal meta data.
    ///
    /// This metric is measured in Sentry after all processing has completed and when it is posted
    /// into node store.
    #[metastructure(field = "bytes.stored.event")]
    pub bytes_stored_event: Annotated<u64>,

    /// The size of the minidump as it is saved in blob store.
    ///
    /// Minidumps are not saved in two conditions. In this case, this number will be zero (missing):
    ///  1. The attachment feature is not enabled for an organization.
    ///  2. The option "Store Native Crash Reports" is disabled (default).
    ///
    /// This metric is measured in Sentry after all processing has completed and when it is posted
    /// into node store.
    #[metastructure(field = "bytes.stored.event.minidump")]
    pub bytes_stored_event_minidump: Annotated<u64>,

    /// The size of the apple crash report as it is saved in blob store.
    ///
    /// Apple crash reports are not saved in two conditions. In this case, this number will be zero
    /// (missing):
    ///  1. The attachment feature is not enabled for an organization.
    ///  2. The option "Store Native Crash Reports" is disabled (default).
    ///
    /// This metric is measured in Sentry after all processing has completed and when it is posted
    /// into node store.
    #[metastructure(field = "bytes.stored.event.applecrashreport")]
    pub bytes_stored_event_applecrashreport: Annotated<u64>,

    /// The cumulative size of all additional attachments as saved in blob store.
    ///
    /// Attachments are not saved if the attachment feature is not enabled for the organization. In
    /// this case, this number will be zero (missing).
    ///
    /// This metric is measured in Sentry after all processing has completed and when it is posted
    /// into node store.
    #[metastructure(field = "bytes.stored.event.attachment")]
    pub bytes_stored_event_attachment: Annotated<u64>,

    /// The number of milliseconds Symbolicator spent processing the native event.
    ///
    /// This metric is measured in Symbolicator and reported in the native processing task. There
    /// are additional overheads polling symbolicator for the response, but the time reported from
    /// symbolicator reflects used resources most accurately.
    #[metastructure(field = "ms.processing.symbolicator")]
    pub ms_processing_symbolicator: Annotated<u64>,

    /// The number of milliseconds Sentry spent resolving proguard mappings for a java event.
    ///
    /// This metric is measured in Sentry and reported in the java processing task.
    #[metastructure(field = "ms.processing.proguard")]
    pub ms_processing_proguard: Annotated<u64>,

    /// The number of milliseconds Sentry spent resolving sources for a java event.
    ///
    /// This metric is measured in Sentry and reported in the java processing task.
    #[metastructure(field = "ms.processing.jvm")]
    pub ms_processing_jvm: Annotated<u64>,

    /// The number of milliseconds sentry spent resolving minified stack traces for a javascript event.
    ///
    /// This metric is measured in Sentry and reported in the javascript processing task.
    #[metastructure(field = "ms.processing.sourcemaps")]
    pub ms_processing_sourcemaps: Annotated<u64>,

    /// Whether there has been a processing error that likely impacts the usefulness of an event.
    ///
    /// Example: malformed/unparseable debug information files.
    ///
    /// This metric is measured in Sentry and should be reported in all processing tasks.
    #[metastructure(field = "flag.processing.error")]
    pub flag_processing_error: Annotated<bool>,

    /// Whether there has been a processing error that almost certainly renders the event
    /// unusuable.
    ///
    /// Example: Minidump could not be parsed, but we do not drop the event as it may still contain
    /// context data and attachments, and we already billed the user anyway.
    ///
    /// This metric is measured in Sentry and should be reported in all processing tasks.
    #[metastructure(field = "flag.processing.fatal")]
    pub flag_processing_fatal: Annotated<bool>,
}

// Do not process Metrics
impl ProcessValue for Metrics {}