feat(client-reports): Client report protocol#1144
Conversation
|
7872da8 to
131cae7
Compare
66c55a9 to
2fc5269
Compare
131cae7 to
91aa345
Compare
2fc5269 to
6bd618a
Compare
91aa345 to
8ab55da
Compare
6bd618a to
1f9b20f
Compare
8ab55da to
15eeea4
Compare
1f9b20f to
a1c5872
Compare
15eeea4 to
ffbee4e
Compare
41afa32 to
ad0ada5
Compare
ffbee4e to
ac9351c
Compare
c738dd0 to
ece93f5
Compare
9e08f3a to
f8521cc
Compare
ece93f5 to
181f46f
Compare
f8521cc to
193723f
Compare
181f46f to
dbf16e8
Compare
| /// The reason why a telemetry item was discarded. | ||
| /// | ||
| /// Valid discard reasons are listed in the [develop docs]; this enum may only define a subset of | ||
| /// these data categories, but we will add further categories as we begin using them in the SDK. | ||
| /// | ||
| /// [develop docs]: https://develop.sentry.dev/sdk/telemetry/client-reports/#discard-reasons-1 | ||
| #[derive(Debug, Serialize, PartialEq, Eq, Hash, Clone, Copy)] | ||
| #[serde(rename_all = "snake_case")] | ||
| #[non_exhaustive] | ||
| pub enum DiscardReason {} | ||
|
|
||
| /// The category of data which was dropped. | ||
| /// | ||
| /// Valid categories are listed in the [develop docs]; this enum may only define a subset of these | ||
| /// valid data categories, but we will add further categories as we begin using them in the SDK. | ||
| /// | ||
| /// [develop docs]: https://develop.sentry.dev/sdk/foundations/transport/rate-limiting/#definitions | ||
| #[derive(Debug, Serialize, PartialEq, Eq, Hash, Clone, Copy)] | ||
| #[serde(rename_all = "snake_case")] | ||
| #[non_exhaustive] | ||
| pub enum DataCategory {} |
There was a problem hiding this comment.
These are intentionally empty right now; I am planning to add variants as needed in future PRs.
|
|
||
| - Added [`TransportFactory::create_transport_with_options`](https://docs.rs/sentry-core/latest/sentry_core/trait.TransportFactory.html#method.create_transport_with_options), which constructs transports from [`TransportOptions`](https://docs.rs/sentry-core/latest/sentry_core/struct.TransportOptions.html) instead of full [`ClientOptions`](https://docs.rs/sentry-core/latest/sentry_core/struct.ClientOptions.html) ([#1142](https://github.com/getsentry/sentry-rust/pull/1142)). | ||
| - Added transport-specific options types and `with_options` constructors for built-in HTTP transports, including `ReqwestHttpTransportOptions`, `CurlHttpTransportOptions`, `UreqHttpTransportOptions`, and `EmbeddedSVCHttpTransportOptions` ([#1142](https://github.com/getsentry/sentry-rust/pull/1142)). | ||
| - Added client report protocol types in `sentry-types`, including [`ClientReport`](https://docs.rs/sentry-types/latest/sentry_types/protocol/v7/struct.ClientReport.html), [`ClientReportItem`](https://docs.rs/sentry-types/latest/sentry_types/protocol/v7/struct.ClientReportItem.html), [`DataCategory`](https://docs.rs/sentry-types/latest/sentry_types/protocol/v7/enum.DataCategory.html), and [`DiscardReason`](https://docs.rs/sentry-types/latest/sentry_types/protocol/v7/enum.DiscardReason.html), plus support for serializing [`client_report` envelope items](https://docs.rs/sentry-types/latest/sentry_types/protocol/v7/enum.EnvelopeItem.html#variant.ClientReport) ([#1144](https://github.com/getsentry/sentry-rust/pull/1144)). |
There was a problem hiding this comment.
These docs.rs links of course do not work yet, but should be accurate after release.
193723f to
87946bc
Compare
543b2cc to
1121016
Compare
87946bc to
f0916b0
Compare
1121016 to
7360117
Compare
37c14e9 to
66d30cb
Compare
This will allow us to add additional construction options, either to all transports or to individual transports, in the future without breaking the public API. This will be useful in #1004, as we will need to provide transports with a handle to record data losses. For users who use a custom transport/transport factory, this change may produce a minor behavior breakage, as the `&ClientOptions` received by the `create_transport` method (or the closure, in the case of transport factories which are just closures) will no longer contain all of the options set when init-ing the SDK, only those options which are also present in `TransportOptions`. As the API remains fully compatible, however, we are not considering this to be a public API breakage, and will release these changes in a minor/patch release. References [#1004](#1004) References [RUST-156](https://linear.app/getsentry/issue/RUST-156/record-transport-drops-and-attach-client-report-envelopes)
Added WIP client report protocol. Resolves [#1001](#1001) Resolves [RUST-153](https://linear.app/getsentry/issue/RUST-153/add-client-report-protocol-envelope-item-support-in-sentry-types)
This refactor should force us to make sure we add EnvelopeItemTypes corresponding to new EnvelopeItems: basically this sort of error should become impossible: #1144 (comment).
4130136 to
263bcb0
Compare
66d30cb to
d6a827e
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d6a827e. Configure here.
| } | ||
|
|
||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| pub(super) struct ClientReportList(Vec<ClientReportItem>); |
There was a problem hiding this comment.
Client report JSON nesting wrong
High Severity
ClientReportList is a single-field tuple struct around Vec<ClientReportItem> with derived Serialize/Deserialize but no #[serde(transparent)]. Serde encodes tuple structs as JSON arrays, so discarded_events becomes a nested array (e.g. [[]] or [[{...}]]) instead of the flat array the client-report protocol expects, breaking envelope serialization and deserialization against Relay and other SDKs.
Reviewed by Cursor Bugbot for commit d6a827e. Configure here.


Added the client report protocol.
Resolves #1001
Resolves RUST-153