feat(attributes): Add device context attributes#300
Conversation
Add device context attributes for memory, simulator, model ID, class, and processor count (deprecated in favor of device.cpu.logical_core_count). 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. |
|
@Lms24 I saw you added we can keep this as stable and have |
There was a problem hiding this comment.
Pull request overview
Adds additional device context attribute definitions (and corresponding generated bindings) aligned with Sentry’s Contexts “device” interface, including a deprecation/alias relationship for device.processor_count.
Changes:
- Added new device attributes:
device.free_memory,device.memory_size,device.simulator,device.model_id,device.class. - Deprecated
device.processor_countand introduced aliasing withdevice.cpu.logical_core_count. - Regenerated Python + JavaScript attribute constants/metadata/types to include the new attributes and aliases.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/deprecated_attributes.json | Registers device.processor_count as deprecated and points to the replacement attribute. |
| python/src/sentry_conventions/attributes.py | Adds new device attribute constants + metadata and updates alias metadata for logical core count. |
| javascript/sentry-conventions/src/attributes.ts | Adds new device attribute exports/types/metadata and updates alias metadata for logical core count. |
| model/attributes/device/device__class.json | New attribute definition for device.class. |
| model/attributes/device/device__free_memory.json | New attribute definition for device.free_memory. |
| model/attributes/device/device__memory_size.json | New attribute definition for device.memory_size. |
| model/attributes/device/device__model_id.json | New attribute definition for device.model_id. |
| model/attributes/device/device__simulator.json | New attribute definition for device.simulator. |
| model/attributes/device/device__processor_count.json | New (deprecated) attribute definition for device.processor_count. |
| model/attributes/device/device__cpu__logical_core_count.json | Updates aliases to include device.processor_count. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add missing cross-references so device.cpu.logical_core_count, hardwareConcurrency, and device.processor_count all list each other as aliases. Also regenerate generated files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: PII marking inconsistent with similar existing memory attribute
- Changed pii from 'false' to 'maybe' for device.memory_size and device.free_memory to be consistent with device.memory.estimated_capacity and other device metrics.
Or push these changes by commenting:
@cursor push 9b7d4cd503
Preview (9b7d4cd503)
diff --git a/model/attributes/device/device__free_memory.json b/model/attributes/device/device__free_memory.json
--- a/model/attributes/device/device__free_memory.json
+++ b/model/attributes/device/device__free_memory.json
@@ -3,7 +3,7 @@
"brief": "Free system memory in bytes.",
"type": "integer",
"pii": {
- "key": "false"
+ "key": "maybe"
},
"is_in_otel": false,
"example": 2147483648,
diff --git a/model/attributes/device/device__memory_size.json b/model/attributes/device/device__memory_size.json
--- a/model/attributes/device/device__memory_size.json
+++ b/model/attributes/device/device__memory_size.json
@@ -3,7 +3,7 @@
"brief": "Total system memory available in bytes.",
"type": "integer",
"pii": {
- "key": "false"
+ "key": "maybe"
},
"is_in_otel": false,
"example": 17179869184,This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Aligns with existing device.memory.estimated_capacity which also uses pii: maybe, since precise memory values could be used for fingerprinting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lms24
left a comment
There was a problem hiding this comment.
@Lms24 I saw you added device.cpu.logical_core_count, in mobile we use device.processor_count which is the exact same attribute.
we can keep this as stable and have device.processor_count be deprecated. wdyt?
Sounds good to me! If both represent the logical and not physical count we should unify them. That being said, if anything in the product depends on device.processor_count, we could also do it the other way around. If not, I'd slightly prefer device.cpu.logical_core_count as it's more explicit.
yup they do
ah good point, I'll double check |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@Lms24 it looks like
so we may have to deprecate it the other way around |
|
Thanks for checking! Then agreed, let's turn it around |
|
@buenaflor actually, you can just remove |
Remove device.cpu.logical_core_count since it was never shipped. Make device.processor_count the canonical attribute and update hardwareConcurrency deprecation to point to device.processor_count. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set prs to [300] for all device context attribute changelog entries that were missing PR references. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>


Description
Add device context attributes based on the Sentry Contexts Interface:
device.free_memory— Free system memory in bytesdevice.memory_size— Total system memory available in bytesdevice.simulator— Whether the device is a simulator or an actual devicedevice.model_id— An internal hardware revision to identify the device exactlydevice.class— The classification of the device (e.g. low, medium, high)device.processor_count— Logical CPU core countPR 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)If an attribute was deprecated: