Skip to content

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

Open
buenaflor wants to merge 8 commits intomainfrom
giancarlobuenaflor/add-device-context-attributes
Open

feat(attributes): Add more device context attributes#303
buenaflor wants to merge 8 commits intomainfrom
giancarlobuenaflor/add-device-context-attributes

Conversation

@buenaflor
Copy link
Copy Markdown
Contributor

@buenaflor buenaflor commented Mar 24, 2026

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.name
  • device.battery_level
  • device.battery_temperature
  • device.boot_time
  • device.brand
  • device.charging
  • device.chipset
  • device.connection_type (deprecated in favor of network.connection.type, no usage of device.connection_type in Sentry)
  • device.cpu_description
  • device.external_free_storage
  • device.external_storage_size
  • device.free_storage
  • device.low_memory
  • device.online
  • device.orientation
  • device.processor_frequency
  • device.screen_density
  • device.screen_dpi
  • device.screen_height_pixels
  • device.screen_width_pixels
  • device.storage_size
  • device.thermal_state
  • device.usable_memory

Network attributes

  • network.connection.type (OTel compat.) — canonical replacement for device.connection_type

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for pii (i.e. maybe or true. Use false only for values that should never be scrubbed such as IDs)

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

github-actions bot commented Mar 24, 2026

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 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
  • (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 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

🤖 This preview updates automatically when you update the PR.

buenaflor and others added 4 commits March 24, 2026 12:03
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>
@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
Copy link
Copy Markdown

Copilot AI left a comment

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.

Copy link
Copy Markdown
Member

@Lms24 Lms24 left a comment

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?

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.

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",
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?

Copy link
Copy Markdown
Contributor Author

@buenaflor buenaflor Mar 25, 2026

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

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

@buenaflor
Copy link
Copy Markdown
Contributor Author

buenaflor commented Mar 25, 2026

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) <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>
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 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>
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