chore: Set device.name to OS hostname on Windows/Linux dedicated servers#391
chore: Set device.name to OS hostname on Windows/Linux dedicated servers#391
Conversation
There was a problem hiding this comment.
In context of game engines, I don't think we should be setting device.name at all - user computer hostname is not relevant to the error. https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/#device-context is generic so hostname there is meant for server-side sdks AFAIK. On consoles, device.name is the console name, e.g. PS5 (as set by the console-specific SDK). On Android, as another example, it's a device model identifier.
Do we do that for Unity or Unreal @bitsandfoxes, @tustanivsky ?
No, we don’t retrieve the device name in Unreal to include it in the event’s context - only hardware info such as CPU/GPU model, amount of RAM, etc. |
|
The hostname can be helpful for some games that offer dedicated server binaries (small number of games really). In those cases, it's actually quite useful information. However, most games don't find it useful. If a game does use it, they could add it themselves perhaps. The question is really, should we add something that is useful for small number of cases, but mostly noise for others? |
If you can recognize the game is running as a server, yes, it's OK to include. Otherwise probably not worth all the noise. |
|
I took a look at how the SDK for Unity is handling it and found some inconsistency: On Android the SDK reports the actual device's name, i.e. Pixel 6. On macOS the device name, which is not great.
I second that. The Sentry SDK for .NET even has a |
|
Thanks for the feedback! Now it's only set in dedicated_server exports. |
This PR sets device.name to OS hostname on Windows and Linux servers, and leaves it unset otherwise.
Note
On dedicated servers, set
device.nameto the OS hostname (Windows/Linux) whensend_default_piiis enabled, and update the changelog.src/sentry/contexts.cpp):dedicated_server, setdevice.nameto OS hostname whensend_default_piiis enabled.gethostnameon Linux,GetComputerNameWon Windows).CHANGELOG.mdunder Improvements to note settingdevice.nameto OS hostname for Windows/Linux dedicated servers.Written by Cursor Bugbot for commit 8494fba. This will update automatically on new commits. Configure here.