Skip to content

Commit 7293ba5

Browse files
committed
Fix device.low_power_mode attribute bugs
- Add missing Python ATTRIBUTE_METADATA and Attributes TypedDict entries - Add missing TypeScript Attributes type entry - Move all DEVICE_LOW_POWER_MODE entries to correct alphabetical position (between DEVICE_FREE_MEMORY and DEVICE_MEMORY_ESTIMATED_CAPACITY) Fixes three bugs: 1. Python bindings missing metadata and TypedDict entries (high severity) 2. TypeScript Attributes type missing new attribute entry (medium severity) 3. New attribute placed in wrong alphabetical position (low severity)
1 parent f95b230 commit 7293ba5

2 files changed

Lines changed: 59 additions & 43 deletions

File tree

‎javascript/sentry-conventions/src/attributes.ts‎

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,6 +2345,26 @@ export const DEVICE_FREE_MEMORY = 'device.free_memory';
23452345
*/
23462346
export type DEVICE_FREE_MEMORY_TYPE = number;
23472347

2348+
// Path: model/attributes/device/device__low_power_mode.json
2349+
2350+
/**
2351+
* Whether the device is in Low Power Mode. `device.low_power_mode`
2352+
*
2353+
* Attribute Value Type: `boolean` {@link DEVICE_LOW_POWER_MODE_TYPE}
2354+
*
2355+
* Contains PII: false
2356+
*
2357+
* Attribute defined in OTEL: No
2358+
*
2359+
* @example true
2360+
*/
2361+
export const DEVICE_LOW_POWER_MODE = 'device.low_power_mode';
2362+
2363+
/**
2364+
* Type for {@link DEVICE_LOW_POWER_MODE} device.low_power_mode
2365+
*/
2366+
export type DEVICE_LOW_POWER_MODE_TYPE = boolean;
2367+
23482368
// Path: model/attributes/device/device__memory__estimated_capacity.json
23492369

23502370
/**
@@ -2469,26 +2489,6 @@ export const DEVICE_SIMULATOR = 'device.simulator';
24692489
*/
24702490
export type DEVICE_SIMULATOR_TYPE = boolean;
24712491

2472-
// Path: model/attributes/device/device__low_power_mode.json
2473-
2474-
/**
2475-
* Whether the device is in Low Power Mode. `device.low_power_mode`
2476-
*
2477-
* Attribute Value Type: `boolean` {@link DEVICE_LOW_POWER_MODE_TYPE}
2478-
*
2479-
* Contains PII: false
2480-
*
2481-
* Attribute defined in OTEL: No
2482-
*
2483-
* @example true
2484-
*/
2485-
export const DEVICE_LOW_POWER_MODE = 'device.low_power_mode';
2486-
2487-
/**
2488-
* Type for {@link DEVICE_LOW_POWER_MODE} device.low_power_mode
2489-
*/
2490-
export type DEVICE_LOW_POWER_MODE_TYPE = boolean;
2491-
24922492
// Path: model/attributes/effectiveConnectionType.json
24932493

24942494
/**
@@ -10347,13 +10347,13 @@ export const ATTRIBUTE_TYPE: Record<string, AttributeType> = {
1034710347
[DEVICE_CLASS]: 'string',
1034810348
[DEVICE_FAMILY]: 'string',
1034910349
[DEVICE_FREE_MEMORY]: 'integer',
10350+
[DEVICE_LOW_POWER_MODE]: 'boolean',
1035010351
[DEVICE_MEMORY_ESTIMATED_CAPACITY]: 'integer',
1035110352
[DEVICE_MEMORY_SIZE]: 'integer',
1035210353
[DEVICE_MODEL]: 'string',
1035310354
[DEVICE_MODEL_ID]: 'string',
1035410355
[DEVICE_PROCESSOR_COUNT]: 'integer',
1035510356
[DEVICE_SIMULATOR]: 'boolean',
10356-
[DEVICE_LOW_POWER_MODE]: 'boolean',
1035710357
[EFFECTIVECONNECTIONTYPE]: 'string',
1035810358
[ENVIRONMENT]: 'string',
1035910359
[ERROR_TYPE]: 'string',
@@ -10836,13 +10836,13 @@ export type AttributeName =
1083610836
| typeof DEVICE_CLASS
1083710837
| typeof DEVICE_FAMILY
1083810838
| typeof DEVICE_FREE_MEMORY
10839+
| typeof DEVICE_LOW_POWER_MODE
1083910840
| typeof DEVICE_MEMORY_ESTIMATED_CAPACITY
1084010841
| typeof DEVICE_MEMORY_SIZE
1084110842
| typeof DEVICE_MODEL
1084210843
| typeof DEVICE_MODEL_ID
1084310844
| typeof DEVICE_PROCESSOR_COUNT
1084410845
| typeof DEVICE_SIMULATOR
10845-
| typeof DEVICE_LOW_POWER_MODE
1084610846
| typeof EFFECTIVECONNECTIONTYPE
1084710847
| typeof ENVIRONMENT
1084810848
| typeof ERROR_TYPE
@@ -12644,6 +12644,17 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
1264412644
example: 2147483648,
1264512645
changelog: [{ version: 'next', prs: [300], description: 'Added device.free_memory attribute' }],
1264612646
},
12647+
[DEVICE_LOW_POWER_MODE]: {
12648+
brief: 'Whether the device is in Low Power Mode.',
12649+
type: 'boolean',
12650+
pii: {
12651+
isPii: 'false',
12652+
},
12653+
isInOtel: false,
12654+
sdks: ['sentry.cocoa'],
12655+
example: true,
12656+
changelog: [{ version: 'next', description: 'Added device.low_power_mode attribute' }],
12657+
},
1264712658
[DEVICE_MEMORY_ESTIMATED_CAPACITY]: {
1264812659
brief:
1264912660
'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 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
1272512736
example: false,
1272612737
changelog: [{ version: 'next', prs: [300], description: 'Added device.simulator attribute' }],
1272712738
},
12728-
[DEVICE_LOW_POWER_MODE]: {
12729-
brief: 'Whether the device is in Low Power Mode.',
12730-
type: 'boolean',
12731-
pii: {
12732-
isPii: 'false',
12733-
},
12734-
isInOtel: false,
12735-
sdks: ['sentry.cocoa'],
12736-
example: true,
12737-
changelog: [{ version: 'next', description: 'Added device.low_power_mode attribute' }],
12738-
},
1273912739
[EFFECTIVECONNECTIONTYPE]: {
1274012740
brief: 'Specifies the estimated effective type of the current connection (e.g. slow-2g, 2g, 3g, 4g).',
1274112741
type: 'string',
@@ -17239,6 +17239,7 @@ export type Attributes = {
1723917239
[DEVICE_CLASS]?: DEVICE_CLASS_TYPE;
1724017240
[DEVICE_FAMILY]?: DEVICE_FAMILY_TYPE;
1724117241
[DEVICE_FREE_MEMORY]?: DEVICE_FREE_MEMORY_TYPE;
17242+
[DEVICE_LOW_POWER_MODE]?: DEVICE_LOW_POWER_MODE_TYPE;
1724217243
[DEVICE_MEMORY_ESTIMATED_CAPACITY]?: DEVICE_MEMORY_ESTIMATED_CAPACITY_TYPE;
1724317244
[DEVICE_MEMORY_SIZE]?: DEVICE_MEMORY_SIZE_TYPE;
1724417245
[DEVICE_MODEL]?: DEVICE_MODEL_TYPE;

‎python/src/sentry_conventions/attributes.py‎

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,16 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
14621462
Example: 2147483648
14631463
"""
14641464

1465+
# Path: model/attributes/device/device__low_power_mode.json
1466+
DEVICE_LOW_POWER_MODE: Literal["device.low_power_mode"] = "device.low_power_mode"
1467+
"""Whether the device is in Low Power Mode.
1468+
1469+
Type: bool
1470+
Contains PII: false
1471+
Defined in OTEL: No
1472+
Example: true
1473+
"""
1474+
14651475
# Path: model/attributes/device/device__memory__estimated_capacity.json
14661476
DEVICE_MEMORY_ESTIMATED_CAPACITY: Literal["device.memory.estimated_capacity"] = (
14671477
"device.memory.estimated_capacity"
@@ -1526,16 +1536,6 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
15261536
Example: false
15271537
"""
15281538

1529-
# Path: model/attributes/device/device__low_power_mode.json
1530-
DEVICE_LOW_POWER_MODE: Literal["device.low_power_mode"] = "device.low_power_mode"
1531-
"""Whether the device is in Low Power Mode.
1532-
1533-
Type: bool
1534-
Contains PII: false
1535-
Defined in OTEL: No
1536-
Example: true
1537-
"""
1538-
15391539
# Path: model/attributes/deviceMemory.json
15401540
DEVICEMEMORY: Literal["deviceMemory"] = "deviceMemory"
15411541
"""The estimated total memory capacity of the device, only a rough estimation in gigabytes.
@@ -7047,6 +7047,20 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
70477047
),
70487048
],
70497049
),
7050+
"device.low_power_mode": AttributeMetadata(
7051+
brief="Whether the device is in Low Power Mode.",
7052+
type=AttributeType.BOOLEAN,
7053+
pii=PiiInfo(isPii=IsPii.FALSE),
7054+
is_in_otel=False,
7055+
example=True,
7056+
sdks=["sentry.cocoa"],
7057+
changelog=[
7058+
ChangelogEntry(
7059+
version="next",
7060+
description="Added device.low_power_mode attribute",
7061+
),
7062+
],
7063+
),
70507064
"device.memory.estimated_capacity": AttributeMetadata(
70517065
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",
70527066
type=AttributeType.INTEGER,
@@ -11613,6 +11627,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
1161311627
"device.class": str,
1161411628
"device.family": str,
1161511629
"device.free_memory": int,
11630+
"device.low_power_mode": bool,
1161611631
"device.memory.estimated_capacity": int,
1161711632
"device.memory_size": int,
1161811633
"device.model": str,

0 commit comments

Comments
 (0)