feat(attributes): Add more device context attributes#303
feat(attributes): Add more device context attributes#303
Conversation
Add 18 new device context attributes that were defined in the Sentry event spec but missing from conventions: battery_level, battery_temperature, boot_time, charging, free_storage, id, low_memory, manufacturer, name, online, orientation, processor_frequency, screen_density, screen_dpi, screen_height_pixels, screen_width_pixels, storage_size, and usable_memory. device.id and device.manufacturer are marked as OTel attributes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Other
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧Deps
Deps Dev
Other
🤖 This preview updates automatically when you update the PR. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ibutes Add device.chipset, device.cpu_description, device.external_storage_size, device.external_free_storage, device.thermal_state, device.connection_type (deprecated), and network.connection.type (OTel) attributes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…onnection_type Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds missing device + network semantic convention attributes (per Sentry device contexts spec and OTel compatibility) to the attribute registry, and regenerates the language bindings and deprecated-attributes export.
Changes:
- Introduces new
device.*attributes for battery, storage, CPU, orientation, etc., plusnetwork.connection.type. - Deprecates
device.connection_typein favor ofnetwork.connection.type(with symmetric aliasing). - Regenerates shared deprecated-attributes JSON and the Python/JavaScript attribute bindings/metadata.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| shared/deprecated_attributes.json | Generated export updated to include newly deprecated device.connection_type. |
| python/src/sentry_conventions/attributes.py | Regenerated Python constants, metadata, and typing map for new attributes + deprecation handling. |
| javascript/sentry-conventions/src/attributes.ts | Regenerated TS constants, types, metadata, and attribute-type mappings for new attributes. |
| model/attributes/network/network__connection__type.json | Adds canonical network.connection.type (OTel) and aliases it with deprecated device.connection_type. |
| model/attributes/device/device__battery_level.json | Adds device.battery_level. |
| model/attributes/device/device__battery_temperature.json | Adds device.battery_temperature. |
| model/attributes/device/device__boot_time.json | Adds device.boot_time. |
| model/attributes/device/device__charging.json | Adds device.charging. |
| model/attributes/device/device__chipset.json | Adds device.chipset. |
| model/attributes/device/device__connection_type.json | Adds and deprecates device.connection_type, with replacement and alias to network.connection.type. |
| model/attributes/device/device__cpu_description.json | Adds device.cpu_description. |
| model/attributes/device/device__external_free_storage.json | Adds device.external_free_storage. |
| model/attributes/device/device__external_storage_size.json | Adds device.external_storage_size. |
| model/attributes/device/device__free_storage.json | Adds device.free_storage. |
| model/attributes/device/device__id.json | Adds device.id (OTel). |
| model/attributes/device/device__low_memory.json | Adds device.low_memory. |
| model/attributes/device/device__manufacturer.json | Adds device.manufacturer (OTel). |
| model/attributes/device/device__name.json | Adds device.name. |
| model/attributes/device/device__online.json | Adds device.online. |
| model/attributes/device/device__orientation.json | Adds device.orientation. |
| model/attributes/device/device__processor_frequency.json | Adds device.processor_frequency. |
| model/attributes/device/device__screen_density.json | Adds device.screen_density. |
| model/attributes/device/device__screen_dpi.json | Adds device.screen_dpi. |
| model/attributes/device/device__screen_height_pixels.json | Adds device.screen_height_pixels. |
| model/attributes/device/device__screen_width_pixels.json | Adds device.screen_width_pixels. |
| model/attributes/device/device__storage_size.json | Adds device.storage_size. |
| model/attributes/device/device__thermal_state.json | Adds device.thermal_state. |
| model/attributes/device/device__usable_memory.json | Adds device.usable_memory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Lms24
left a comment
There was a problem hiding this comment.
Just to confirm: All of these are already sent from mobile SDKs today?
There was a problem hiding this comment.
head-sup: I have #279 open which also covers this attribute. Unfortunately, it didn't receive any reviews for a while now. I'll ask again. Btw, if yours gets merged first that's totally fine 😅 no need to remove it from the PR!
| @@ -0,0 +1,17 @@ | |||
| { | |||
| "key": "device.name", | |||
There was a problem hiding this comment.
OTel has device.model.name. Is there a semantic difference? Otherwise wdyt about using the OTel version?
There was a problem hiding this comment.
I think device.model.name is represented by our device.model.
and OTel device.model.identifier is device.model_id
I'd also prefer the OTel ones so once we establish the processes in how to deprecate those cases that are already used in the product we can deprecate and use the OTel conventions instead
yes all attrs mentioned here (except for the new network connection attribute) are sent from mobile sdks under contexts in events |
…utes Resolve merge conflicts in network.connection.type attribute by combining both alias sets (device.connection_type and connectionType) and regenerating TS/Python attribute files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensure device.connection_type and connectionType both cross-reference all members of the alias group, matching network.connection.type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
The generated files were missing aliases for device.connection_type and connectionType that were present in the source JSON definitions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Description
Add device context attributes that are defined in the Sentry device contexts spec and used in mobile today but were missing from conventions:
Device attributes
device.id(OTel compat.)device.manufacturer(OTel compat.)device.namedevice.battery_leveldevice.battery_temperaturedevice.boot_timedevice.branddevice.chargingdevice.chipsetdevice.connection_type(deprecated in favor ofnetwork.connection.type, no usage ofdevice.connection_typein Sentry)device.cpu_descriptiondevice.external_free_storagedevice.external_storage_sizedevice.free_storagedevice.low_memorydevice.onlinedevice.orientationdevice.processor_frequencydevice.screen_densitydevice.screen_dpidevice.screen_height_pixelsdevice.screen_width_pixelsdevice.storage_sizedevice.thermal_statedevice.usable_memoryNetwork attributes
network.connection.type(OTel compat.) — canonical replacement fordevice.connection_typePR Checklist
yarn testand verified that the tests pass.yarn generateto generate and format code and docs.If an attribute was added:
nextjs.function_id, notfunction_id)pii(i.e.maybeortrue. Usefalseonly for values that should never be scrubbed such as IDs)