relay_event_schema/protocol/
metrics.rs

1use relay_protocol::{Annotated, Empty, FromValue, IntoValue};
2
3use crate::processor::ProcessValue;
4
5/// Metrics captured during event ingestion and processing.
6///
7/// These values are collected in Relay and Sentry and finally persisted into the event payload. A
8/// value of `0` is equivalent to N/A and should not be considered in aggregations and analysis.
9#[derive(Clone, Debug, Default, Empty, PartialEq, FromValue, IntoValue)]
10pub struct Metrics {
11    /// The size of the original event payload ingested into Sentry.
12    ///
13    /// The size is measured after applying all content- and transfer-encodings  and thus
14    /// independent of compression over the wire.
15    ///
16    /// For security reports, this is the size of the JSON request sent by the browser and not of
17    /// the event payload we extract from it. For ingested envelopes, this is only the size of the
18    /// "event" item.
19    ///
20    /// This metric is measured in Relay during ingestion.
21    #[metastructure(field = "bytes.ingested.event")]
22    pub bytes_ingested_event: Annotated<u64>,
23
24    /// The size of the minidump ingested into Sentry.
25    ///
26    /// The size is measured after applying all content- and transfer-encodings  and thus
27    /// independent of compression over the wire.
28    ///
29    /// This metric is measured in Relay during ingestion.
30    #[metastructure(field = "bytes.ingested.event.minidump")]
31    pub bytes_ingested_event_minidump: Annotated<u64>,
32
33    /// The size of an apple crash report ingested into Sentry.
34    ///
35    /// The size is measured after applying all content- and transfer-encodings  and thus
36    /// independent of compression over the wire.
37    ///
38    /// This metric is measured in Relay during ingestion.
39    #[metastructure(field = "bytes.ingested.event.applecrashreport")]
40    pub bytes_ingested_event_applecrashreport: Annotated<u64>,
41
42    /// The cumulative size of all additional attachments ingested into Sentry.
43    ///
44    /// This is a sum of all all generic attachment payloads (excluding headers). These attachments
45    /// are never processed and only potentially stored. Minidumps and apple crash reports are
46    /// counted separately in their respective metrics.
47    ///
48    /// This metric is measured in Relay during ingestion.
49    #[metastructure(field = "bytes.ingested.event.attachment")]
50    pub bytes_ingested_event_attachment: Annotated<u64>,
51
52    /// The size of the event payload as it is saved in node store.
53    ///
54    /// For security reports, this is the size of the event derived from the original JSON. For
55    /// processed events, such as native or javascript, this includes information derived during
56    /// symbolication and internal meta data.
57    ///
58    /// This metric is measured in Sentry after all processing has completed and when it is posted
59    /// into node store.
60    #[metastructure(field = "bytes.stored.event")]
61    pub bytes_stored_event: Annotated<u64>,
62
63    /// The size of the minidump as it is saved in blob store.
64    ///
65    /// Minidumps are not saved in two conditions. In this case, this number will be zero (missing):
66    ///  1. The attachment feature is not enabled for an organization.
67    ///  2. The option "Store Native Crash Reports" is disabled (default).
68    ///
69    /// This metric is measured in Sentry after all processing has completed and when it is posted
70    /// into node store.
71    #[metastructure(field = "bytes.stored.event.minidump")]
72    pub bytes_stored_event_minidump: Annotated<u64>,
73
74    /// The size of the apple crash report as it is saved in blob store.
75    ///
76    /// Apple crash reports are not saved in two conditions. In this case, this number will be zero
77    /// (missing):
78    ///  1. The attachment feature is not enabled for an organization.
79    ///  2. The option "Store Native Crash Reports" is disabled (default).
80    ///
81    /// This metric is measured in Sentry after all processing has completed and when it is posted
82    /// into node store.
83    #[metastructure(field = "bytes.stored.event.applecrashreport")]
84    pub bytes_stored_event_applecrashreport: Annotated<u64>,
85
86    /// The cumulative size of all additional attachments as saved in blob store.
87    ///
88    /// Attachments are not saved if the attachment feature is not enabled for the organization. In
89    /// this case, this number will be zero (missing).
90    ///
91    /// This metric is measured in Sentry after all processing has completed and when it is posted
92    /// into node store.
93    #[metastructure(field = "bytes.stored.event.attachment")]
94    pub bytes_stored_event_attachment: Annotated<u64>,
95
96    /// The number of milliseconds Symbolicator spent processing the native event.
97    ///
98    /// This metric is measured in Symbolicator and reported in the native processing task. There
99    /// are additional overheads polling symbolicator for the response, but the time reported from
100    /// symbolicator reflects used resources most accurately.
101    #[metastructure(field = "ms.processing.symbolicator")]
102    pub ms_processing_symbolicator: Annotated<u64>,
103
104    /// The number of milliseconds Sentry spent resolving proguard mappings for a java event.
105    ///
106    /// This metric is measured in Sentry and reported in the java processing task.
107    #[metastructure(field = "ms.processing.proguard")]
108    pub ms_processing_proguard: Annotated<u64>,
109
110    /// The number of milliseconds Sentry spent resolving sources for a java event.
111    ///
112    /// This metric is measured in Sentry and reported in the java processing task.
113    #[metastructure(field = "ms.processing.jvm")]
114    pub ms_processing_jvm: Annotated<u64>,
115
116    /// The number of milliseconds sentry spent resolving minified stack traces for a javascript event.
117    ///
118    /// This metric is measured in Sentry and reported in the javascript processing task.
119    #[metastructure(field = "ms.processing.sourcemaps")]
120    pub ms_processing_sourcemaps: Annotated<u64>,
121
122    /// Whether there has been a processing error that likely impacts the usefulness of an event.
123    ///
124    /// Example: malformed/unparseable debug information files.
125    ///
126    /// This metric is measured in Sentry and should be reported in all processing tasks.
127    #[metastructure(field = "flag.processing.error")]
128    pub flag_processing_error: Annotated<bool>,
129
130    /// Whether there has been a processing error that almost certainly renders the event
131    /// unusuable.
132    ///
133    /// Example: Minidump could not be parsed, but we do not drop the event as it may still contain
134    /// context data and attachments, and we already billed the user anyway.
135    ///
136    /// This metric is measured in Sentry and should be reported in all processing tasks.
137    #[metastructure(field = "flag.processing.fatal")]
138    pub flag_processing_fatal: Annotated<bool>,
139}
140
141// Do not process Metrics
142impl ProcessValue for Metrics {}