@@ -196,11 +196,44 @@ The `type` and default key is `"device"`.
196196
197197## OS Context
198198
199- OS context describes the operating system on which the event was created. In web
200- contexts, this is the operating system of the browser (generally pulled from the
201- User-Agent string).
199+ OS context under the default key ` "os" ` describes the operating system on which
200+ the crash happened/the event was created.
202201
203- The ` type ` and default key is ` "os" ` .
202+ The ` type ` and default key is ` "os" ` . However, since contexts can be set
203+ multiple times under different keys, there has historically been a lot of
204+ confusion about which OS context represents what. So here's some examples:
205+
206+ * In events reported from a Python/ASP.NET/Rails web backend, the OS context
207+ under the default key ` "os" ` is the server's operating system, and is set by
208+ the SDK (if at all).
209+
210+ Additionally, the Sentry server will attempt to parse the ` User-Agent ` header
211+ from the event's [ Request Interface] ( /sdk/event-payloads/request/ ) and create a _ secondary_ OS
212+ context under the non-default key ` "client_os" ` .
213+
214+ * In events reported from a JS web frontend, the SDK typically reports no OS
215+ context.
216+
217+ The server however knows by looking at the platform (` "javascript" ` ) that the
218+ incoming User-Agent can only come from the crashing device, and creates the
219+ User-Agent based OS context under the default key ` "os" ` .
220+
221+ To summarize:
222+
223+ * ` "os" ` key for the device generating the event.
224+ * ` "client_os" ` key for an adjacent client device's OS (that is _ not_ the
225+ device creating the event) if it's important. The Sentry server sets this as part of
226+ User-Agent parsing, but SDKs can set this directly too.
227+ * If in doubt, just send ` "os" ` . Any other keys are not searchable in the
228+ product and will not be visually pronounced using icons, so using something
229+ like ` "server_os" ` to clarify what you meant is probably going to
230+ backfire with regards to the overall product experience.
231+
232+ Under the existing mental model, a hypothetical ` "server_os" ` key would
233+ actually mean you're reporting the operating system of an adjacent "upstream"
234+ device that the crashing device is talking to.
235+
236+ As Kurt Tucholsky said: "The opposite of good is not evil, but good intentions"
204237
205238` name `
206239
0 commit comments