Skip to content

feat(attributes): Add device.low_power_mode attribute for iOS - #314

Merged
itaybre merged 4 commits into
mainfrom
feat/device-low-power-mode
Apr 20, 2026
Merged

itaybre merged 4 commits into
mainfrom
feat/device-low-power-mode

Conversation

@itaybre

@itaybre itaybre commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds device.low_power_mode boolean attribute to document whether an iOS device is in Low Power Mode
  • Scoped to sentry.cocoa SDK
  • Updates JavaScript (attributes.ts) and Python (attributes.py) bindings

Test plan

  • Verify yarn test:js passes
  • Add the PR number to the prs field in model/attributes/device/device__low_power_mode.json changelog

🤖 Generated with Claude Code

@itaybre
itaybre requested review from a team, Lms24, cleptric, lcian, mjq and nsdeschenes as code owners April 8, 2026 21:04
@github-actions

github-actions Bot commented Apr 8, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (attributes) Add device.low_power_mode attribute for iOS by itaybre in #314

🤖 This preview updates automatically when you update the PR.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Python bindings missing metadata and TypedDict entries
    • Added device.low_power_mode entries to both ATTRIBUTE_METADATA dictionary and Attributes TypedDict in correct alphabetical position.
  • ✅ Fixed: TypeScript Attributes type missing new attribute entry
    • Added [DEVICE_LOW_POWER_MODE]?: DEVICE_LOW_POWER_MODE_TYPE entry to the Attributes type in correct alphabetical position.
  • ✅ Fixed: New attribute placed in wrong alphabetical position
    • Moved all DEVICE_LOW_POWER_MODE entries from after DEVICE_SIMULATOR to between DEVICE_FREE_MEMORY and DEVICE_MEMORY_ESTIMATED_CAPACITY in all sections of both files.

Create PR

Or push these changes by commenting:

@cursor push 7293ba5b57
Preview (7293ba5b57)
diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts
--- a/javascript/sentry-conventions/src/attributes.ts
+++ b/javascript/sentry-conventions/src/attributes.ts
@@ -2345,6 +2345,26 @@
  */
 export type DEVICE_FREE_MEMORY_TYPE = number;
 
+// Path: model/attributes/device/device__low_power_mode.json
+
+/**
+ * Whether the device is in Low Power Mode. `device.low_power_mode`
+ *
+ * Attribute Value Type: `boolean` {@link DEVICE_LOW_POWER_MODE_TYPE}
+ *
+ * Contains PII: false
+ *
+ * Attribute defined in OTEL: No
+ *
+ * @example true
+ */
+export const DEVICE_LOW_POWER_MODE = 'device.low_power_mode';
+
+/**
+ * Type for {@link DEVICE_LOW_POWER_MODE} device.low_power_mode
+ */
+export type DEVICE_LOW_POWER_MODE_TYPE = boolean;
+
 // Path: model/attributes/device/device__memory__estimated_capacity.json
 
 /**
@@ -2469,26 +2489,6 @@
  */
 export type DEVICE_SIMULATOR_TYPE = boolean;
 
-// Path: model/attributes/device/device__low_power_mode.json
-
-/**
- * Whether the device is in Low Power Mode. `device.low_power_mode`
- *
- * Attribute Value Type: `boolean` {@link DEVICE_LOW_POWER_MODE_TYPE}
- *
- * Contains PII: false
- *
- * Attribute defined in OTEL: No
- *
- * @example true
- */
-export const DEVICE_LOW_POWER_MODE = 'device.low_power_mode';
-
-/**
- * Type for {@link DEVICE_LOW_POWER_MODE} device.low_power_mode
- */
-export type DEVICE_LOW_POWER_MODE_TYPE = boolean;
-
 // Path: model/attributes/effectiveConnectionType.json
 
 /**
@@ -10347,13 +10347,13 @@
   [DEVICE_CLASS]: 'string',
   [DEVICE_FAMILY]: 'string',
   [DEVICE_FREE_MEMORY]: 'integer',
+  [DEVICE_LOW_POWER_MODE]: 'boolean',
   [DEVICE_MEMORY_ESTIMATED_CAPACITY]: 'integer',
   [DEVICE_MEMORY_SIZE]: 'integer',
   [DEVICE_MODEL]: 'string',
   [DEVICE_MODEL_ID]: 'string',
   [DEVICE_PROCESSOR_COUNT]: 'integer',
   [DEVICE_SIMULATOR]: 'boolean',
-  [DEVICE_LOW_POWER_MODE]: 'boolean',
   [EFFECTIVECONNECTIONTYPE]: 'string',
   [ENVIRONMENT]: 'string',
   [ERROR_TYPE]: 'string',
@@ -10836,13 +10836,13 @@
   | typeof DEVICE_CLASS
   | typeof DEVICE_FAMILY
   | typeof DEVICE_FREE_MEMORY
+  | typeof DEVICE_LOW_POWER_MODE
   | typeof DEVICE_MEMORY_ESTIMATED_CAPACITY
   | typeof DEVICE_MEMORY_SIZE
   | typeof DEVICE_MODEL
   | typeof DEVICE_MODEL_ID
   | typeof DEVICE_PROCESSOR_COUNT
   | typeof DEVICE_SIMULATOR
-  | typeof DEVICE_LOW_POWER_MODE
   | typeof EFFECTIVECONNECTIONTYPE
   | typeof ENVIRONMENT
   | typeof ERROR_TYPE
@@ -12644,6 +12644,17 @@
     example: 2147483648,
     changelog: [{ version: 'next', prs: [300], description: 'Added device.free_memory attribute' }],
   },
+  [DEVICE_LOW_POWER_MODE]: {
+    brief: 'Whether the device is in Low Power Mode.',
+    type: 'boolean',
+    pii: {
+      isPii: 'false',
+    },
+    isInOtel: false,
+    sdks: ['sentry.cocoa'],
+    example: true,
+    changelog: [{ version: 'next', description: 'Added device.low_power_mode attribute' }],
+  },
   [DEVICE_MEMORY_ESTIMATED_CAPACITY]: {
     brief:
       'The estimated total memory capacity of the device, only a rough estimation in gigabytes. Browsers report estimations in buckets of powers of 2, mostly capped at 8 GB',
@@ -12725,17 +12736,6 @@
     example: false,
     changelog: [{ version: 'next', prs: [300], description: 'Added device.simulator attribute' }],
   },
-  [DEVICE_LOW_POWER_MODE]: {
-    brief: 'Whether the device is in Low Power Mode.',
-    type: 'boolean',
-    pii: {
-      isPii: 'false',
-    },
-    isInOtel: false,
-    sdks: ['sentry.cocoa'],
-    example: true,
-    changelog: [{ version: 'next', description: 'Added device.low_power_mode attribute' }],
-  },
   [EFFECTIVECONNECTIONTYPE]: {
     brief: 'Specifies the estimated effective type of the current connection (e.g. slow-2g, 2g, 3g, 4g).',
     type: 'string',
@@ -17239,6 +17239,7 @@
   [DEVICE_CLASS]?: DEVICE_CLASS_TYPE;
   [DEVICE_FAMILY]?: DEVICE_FAMILY_TYPE;
   [DEVICE_FREE_MEMORY]?: DEVICE_FREE_MEMORY_TYPE;
+  [DEVICE_LOW_POWER_MODE]?: DEVICE_LOW_POWER_MODE_TYPE;
   [DEVICE_MEMORY_ESTIMATED_CAPACITY]?: DEVICE_MEMORY_ESTIMATED_CAPACITY_TYPE;
   [DEVICE_MEMORY_SIZE]?: DEVICE_MEMORY_SIZE_TYPE;
   [DEVICE_MODEL]?: DEVICE_MODEL_TYPE;

diff --git a/python/src/sentry_conventions/attributes.py b/python/src/sentry_conventions/attributes.py
--- a/python/src/sentry_conventions/attributes.py
+++ b/python/src/sentry_conventions/attributes.py
@@ -1462,6 +1462,16 @@
     Example: 2147483648
     """
 
+    # Path: model/attributes/device/device__low_power_mode.json
+    DEVICE_LOW_POWER_MODE: Literal["device.low_power_mode"] = "device.low_power_mode"
+    """Whether the device is in Low Power Mode.
+
+    Type: bool
+    Contains PII: false
+    Defined in OTEL: No
+    Example: true
+    """
+
     # Path: model/attributes/device/device__memory__estimated_capacity.json
     DEVICE_MEMORY_ESTIMATED_CAPACITY: Literal["device.memory.estimated_capacity"] = (
         "device.memory.estimated_capacity"
@@ -1526,16 +1536,6 @@
     Example: false
     """
 
-    # Path: model/attributes/device/device__low_power_mode.json
-    DEVICE_LOW_POWER_MODE: Literal["device.low_power_mode"] = "device.low_power_mode"
-    """Whether the device is in Low Power Mode.
-
-    Type: bool
-    Contains PII: false
-    Defined in OTEL: No
-    Example: true
-    """
-
     # Path: model/attributes/deviceMemory.json
     DEVICEMEMORY: Literal["deviceMemory"] = "deviceMemory"
     """The estimated total memory capacity of the device, only a rough estimation in gigabytes.
@@ -7047,6 +7047,20 @@
             ),
         ],
     ),
+    "device.low_power_mode": AttributeMetadata(
+        brief="Whether the device is in Low Power Mode.",
+        type=AttributeType.BOOLEAN,
+        pii=PiiInfo(isPii=IsPii.FALSE),
+        is_in_otel=False,
+        example=True,
+        sdks=["sentry.cocoa"],
+        changelog=[
+            ChangelogEntry(
+                version="next",
+                description="Added device.low_power_mode attribute",
+            ),
+        ],
+    ),
     "device.memory.estimated_capacity": AttributeMetadata(
         brief="The estimated total memory capacity of the device, only a rough estimation in gigabytes. Browsers report estimations in buckets of powers of 2, mostly capped at 8 GB",
         type=AttributeType.INTEGER,
@@ -11613,6 +11627,7 @@
         "device.class": str,
         "device.family": str,
         "device.free_memory": int,
+        "device.low_power_mode": bool,
         "device.memory.estimated_capacity": int,
         "device.memory_size": int,
         "device.model": str,

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f95b230. Configure here.

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense from my end!

@buenaflor buenaflor left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! please take a look at the bot comments if they are relevant

you prolly need to run the generate commands again

@itaybre
itaybre merged commit ce16753 into main Apr 20, 2026
11 checks passed
@itaybre
itaybre deleted the feat/device-low-power-mode branch April 20, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants