Skip to content

feat(attributes): Add more device context attributes - #303

Merged
buenaflor merged 17 commits into
mainfrom
giancarlobuenaflor/add-device-context-attributes
Apr 14, 2026
Merged

buenaflor merged 17 commits into
mainfrom
giancarlobuenaflor/add-device-context-attributes

Conversation

@buenaflor

@buenaflor buenaflor commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Add device context and network connection attributes from the Sentry event schema that were previously missing from sentry-conventions.

Device context attributes:

  • device.battery_level, device.battery_temperature, device.boot_time, device.charging
  • device.chipset, device.cpu_description, device.id, device.low_memory
  • device.manufacturer, device.name, device.online, device.orientation
  • device.processor_frequency, device.processor_count, device.screen_density, device.screen_dpi
  • device.screen_height_pixels, device.screen_width_pixels
  • device.storage_size, device.free_storage, device.external_storage_size, device.external_free_storage
  • device.memory_size, device.free_memory, device.usable_memory
  • device.thermal_state
  • device.archs (string array for CPU architectures)
  • device.connection_type (deprecated in favor of network.connection.type)

Deprecated device.connection_type has symmetric aliases with its replacement and uses backfill deprecation status per repo policy.

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 <[email protected]>
@buenaflor buenaflor changed the title feat(attributes): Add remaining device context attributes feat(attributes): Add more device context attributes Mar 24, 2026
@github-actions

github-actions Bot commented Mar 24, 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 more device context attributes by buenaflor in #303
  • Add gen_ai.context.window_size and gen_ai.context.utilization for generation spans by constantinius in #315
  • Add db.driver.name attribute by alexander-alderman-webb in #295
  • Add network connection-related attributes by Lms24 in #279
  • Add cache.write attribute by adinauer in #292
  • Add device context attributes by buenaflor in #300
  • Add app context attributes for mobile by buenaflor in #296
  • Add device memory and core count attributes by Lms24 in #281
  • Add ui.element.* attributes by Lms24 in #284
  • Add remaining TTFB, FCP and FP web vital attributes by Lms24 in #235
  • Add LCP web vital meta attributes by Lms24 in #233
  • Add CLS web vital source attribute by Lms24 in #234
  • Add core web web vital value attributes by Lms24 in #229
  • Add allow_any_value field to attribute schema by vgrozdanic in #272

Other

  • (http) Add http.server.request.time_in_queue attribute by dingsdax in #267
  • (resource) Add resource.deployment.environment by mjq in #266
  • Add sentry.timestamp.sequence attribute to the spec by logaretm in #262
  • Add changelog tracking to attribute definitions by ericapisani in #270

Bug Fixes 🐛

  • (attributes) Remove allow_any_value boolean attribute and allow any as type by vgrozdanic in #273
  • (gen_ai) Input and output token description by obostjancic in #261
  • (release) Run yarn install before yarn generate in pre-release script by vgrozdanic in #316
  • (sentry) Deprecate sentry.trace.parent_span_id by mjq in #287
  • Don't run changelog generation on yarn generate by Lms24 in #277
  • Avoid changelog generation recursion by Lms24 in #274

Documentation 📚

  • (sentry) Add deprecated sentry.source by s1gr1d in #288
  • Redirect from old /generated pages to new routes by Lms24 in #291
  • Remove extra yarn run format instruction by mjq in #289
  • Update README with up-to-date links by ericapisani in #258

Internal Changes 🔧

Deps

  • Bump defu from 6.1.4 to 6.1.6 by dependabot in #309
  • Bump vite from 6.4.1 to 6.4.2 by dependabot in #310
  • Bump pygments from 2.19.2 to 2.20.0 in /python by dependabot in #307
  • Bump smol-toml from 1.6.0 to 1.6.1 by dependabot in #305
  • Bump h3 from 1.15.5 to 1.15.9 by dependabot in #299
  • Bump devalue from 5.6.3 to 5.6.4 by dependabot in #286
  • Bump dompurify from 3.3.1 to 3.3.2 by dependabot in #278
  • Bump svgo from 3.3.2 to 3.3.3 by dependabot in #275
  • Bump svelte from 5.51.5 to 5.53.5 by dependabot in #271
  • Bump rollup from 4.40.1 to 4.59.0 by dependabot in #269
  • Bump svelte from 5.48.1 to 5.51.5 by dependabot in #260

Deps Dev

  • Bump tar from 7.5.10 to 7.5.11 by dependabot in #285
  • Bump tar from 7.5.8 to 7.5.10 by dependabot in #276
  • Bump tar from 7.5.7 to 7.5.8 by dependabot in #259

Other

  • (ai) Deprecate rest of ai.* attributes by constantinius in #264
  • (attributes) Ensure each attribute json has a changelog entry by Lms24 in #282
  • (docs) Upgrade to Astro 6 by Lms24 in #283
  • (gen_ai) Deprecate gen_ai.tool.input, gen_ai.tool.message, gen_ai.tool.output by constantinius in #265
  • (publish) Bump next entries in changelog when releasing by Lms24 in #290
  • (repo) Populate changelog property when running yarn create:attribute by Lms24 in #280
  • Pin GitHub Actions to full-length commit SHAs by joshuarli in #302
  • Wrong link to CONTRIBUTING.md in PR template by sentrivana in #298

Other

  • deprecate(attributes): Mark gen_ai.tool.type as deprecated by ericapisani in #312

🤖 This preview updates automatically when you update the PR.

buenaflor and others added 4 commits March 24, 2026 12:03
…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) <[email protected]>
…onnection_type

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@buenaflor
buenaflor marked this pull request as ready for review March 24, 2026 14:09
@buenaflor
buenaflor requested review from a team, Lms24, cleptric, lcian, mjq and nsdeschenes as code owners March 24, 2026 14:09
Copilot AI review requested due to automatic review settings March 24, 2026 14:09

Copilot AI 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.

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., plus network.connection.type.
  • Deprecates device.connection_type in favor of network.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 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.

Just to confirm: All of these are already sent from mobile SDKs today?

@@ -0,0 +1,17 @@
{
"key": "device.name",

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.

OTel has device.model.name. Is there a semantic difference? Otherwise wdyt about using the OTel version?

@buenaflor buenaflor Mar 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think device.model.name is represented by our device.model.

and OTel device.model.identifier is device.model_id

@buenaflor

buenaflor commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Just to confirm: All of these are already sent from mobile SDKs today?

yes all attrs mentioned here (except for the new network connection attribute) are sent from mobile sdks under contexts in events

@buenaflor
buenaflor requested a review from Lms24 March 30, 2026 08:14
…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) <[email protected]>
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) <[email protected]>
Comment thread shared/deprecated_attributes.json Resolved
buenaflor and others added 5 commits March 30, 2026 14:39
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) <[email protected]>
Add device.archs as a string array attribute representing CPU
architectures of the device, e.g. arm64-v8a, armeabi-v7a, armeabi.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add device.timezone and device.locale as deprecated attributes in
favor of culture.timezone and culture.locale respectively. Add
symmetric aliases between the device and culture attribute pairs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@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 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing PR references in deprecated attributes changelog
    • Updated both device.locale and device.timezone entries in shared/deprecated_attributes.json to have "prs": [303] matching the source model files.

Create PR

Or push these changes by commenting:

@cursor push dd1e762a49
Preview (dd1e762a49)
diff --git a/shared/deprecated_attributes.json b/shared/deprecated_attributes.json
--- a/shared/deprecated_attributes.json
+++ b/shared/deprecated_attributes.json
@@ -1551,7 +1551,7 @@
       "changelog": [
         {
           "version": "next",
-          "prs": [],
+          "prs": [303],
           "description": "Added and deprecated device.locale in favor of culture.locale"
         }
       ]
@@ -1574,7 +1574,7 @@
       "changelog": [
         {
           "version": "next",
-          "prs": [],
+          "prs": [303],
           "description": "Added and deprecated device.timezone in favor of culture.timezone"
         }
       ]

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

Reviewed by Cursor Bugbot for commit ec28533. Configure here.

Comment thread shared/deprecated_attributes.json Resolved
buenaflor and others added 5 commits April 7, 2026 11:43
…cale and device.timezone

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Only device.connection_type should be deprecated in this branch.
device.locale and device.timezone are not being deprecated since
culture.locale and culture.timezone already exist as the canonical
attributes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ated aliases

These attributes are sent by SDKs and should be recognized, but are not
deprecated — they are symmetric aliases of culture.locale and
culture.timezone.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Remove alias relationships with culture.locale/culture.timezone — these
are independent stable attributes, not aliases.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@buenaflor
buenaflor merged commit baf7bb6 into main Apr 14, 2026
12 checks passed
@buenaflor
buenaflor deleted the giancarlobuenaflor/add-device-context-attributes branch April 14, 2026 11:11
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