Skip to content

Commit 0e24920

Browse files
authored
Document catchall variant for protocol enums (#14947)
See for example getsentry/relay#5144.
1 parent a14a18d commit 0e24920

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

develop-docs/ingestion/relay/relay-best-practices.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Make sure changes to the event protocol and APIs are forward-compatible. Relay s
1616
or truncate data it does not understand. It is a supported use-case to have customers running
1717
outdated Relays but up-to-date SDKs.
1818

19+
For example, `enum`s in the event protocol (or any other data type received from the SDK) need to have a catchall variant
20+
such that customer relays running an older version can still forward the data:
21+
22+
```rust
23+
enum EventColor {
24+
Red,
25+
Green,
26+
Blue,
27+
/// Unknown color, for forward compatibility.
28+
Unknown(String),
29+
}
30+
```
1931

2032
## Feature Gate new Functionality
2133

0 commit comments

Comments
 (0)