Skip to content

RUM-9494: Align os and device attributes across all product features#2322

Merged
simaoseica-dd merged 4 commits into
feature/v3from
simaoseica/RUM-9494/align-os-and-device-attributes
Jun 16, 2025
Merged

RUM-9494: Align os and device attributes across all product features#2322
simaoseica-dd merged 4 commits into
feature/v3from
simaoseica/RUM-9494/align-os-and-device-attributes

Conversation

@simaoseica-dd

@simaoseica-dd simaoseica-dd commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

What and why?

This PR aligns the os and device details sent to the Datadog intake across Logs, RUM and Trace features.
It aims to have consistent models across features to improve discoverability and future additions of more information.

How?

The main point to address consistency is to have central models that can be reused across the product features.
This means that we have just one model definition of Device and OperatingSystem. They are defined on DatadogInternal and all redundant models are removed.
The models respect the schema defined for RUM models including being set in the root of the event as common parameters across events.
For more details on the properties and types, you can refer to the Device schema and OS schema.

RUM Event Log Event Span Event
rum log span

Note 1: The Log events have _dd and http parameters with extra device and os information. The _dd has the device architecture to help symbolication and deobfuscation and the http device info is added by the backend after the intake.
Note 2: There is a second DeviceInfo model (not Codable) but it is used only for internal logic defined in the DatadogContext.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes
  • Add Objective-C interface for public APIs (see our guidelines (internal) and run make api-surface)

@simaoseica-dd
simaoseica-dd requested review from a team as code owners June 5, 2025 11:47
mariedm
mariedm previously approved these changes Jun 6, 2025

@maxep maxep 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.

Looks good! I left some minor comments.

self.systemBootTime = systemBootTime
}

public var rumDevice: Device {

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.

suggestion/ Does the rum* properties needs to be defined in the Internal module? Can it be extensions on the RUM module instead?

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 it is a question of naming since the Device and OS are now common models for all the feature products.
I renamed it to normalizedDevice to better state this.

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.

I see the motivation, the thing is that we are crossing domains here and we are hiding that fact: this model (same as OperatingSystem) is a RUM generated definition but this is no longer explicit. I think we should keep the RUM* prefix in the generator and create an extension for casting, such as:

extension RUMDevice: {
    init(_ deviceInfo: DeviceInfo)
}

This way, it will be explicit that we are applying the RUM format across domains. And it will be clear that this definition is coming from the generated models. Would that make sense?
It is a nit pick but I feel it will make thing easier to navigate.

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.

We want to have the feature products isolated from each other. In this case, we want to make sure that the RUM concepts are not leaked to the features using device and operating system models, like Tracing, Logs and Crash Reporting.
And with this approach we can avoid redundant models at the same time we follow a schema that can be updated in the future.

Comment thread DatadogInternal/Sources/Context/DeviceInfo.swift Outdated
Comment thread DatadogInternal/Sources/Context/OperatingSystem+Utils.swift Outdated
Comment thread DatadogInternal/Sources/Context/DeviceInfo.swift Outdated
Comment on lines +103 to +106
public struct Device: Codable {
/// The CPU architecture of the device. Used to symbolication and deobfuscation.
public let architecture: String
}

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.

So we are duplicating the architecture attribute here for symbolication. Have we consider placing all device info in _dd.device, and _dd.os?

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.

Yes, it was considered but was not followed because:

  • After discussion with @0xnm we can improve this logic ourselves in the backend and get rid of the _dd namespace without much trouble.
  • The current organization, os and device being in the root of the event, is consistent across all feature products. It follows this premise by respecting the schema.

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.

OK 👍 All good if we plan to remove this duplicate.

@simaoseica-dd
simaoseica-dd force-pushed the simaoseica/RUM-9494/align-os-and-device-attributes branch from a36a4a8 to e699161 Compare June 11, 2025 14:36
@simaoseica-dd
simaoseica-dd force-pushed the simaoseica/RUM-9494/align-os-and-device-attributes branch from e699161 to 875e7a5 Compare June 11, 2025 14:38
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jun 11, 2025

Copy link
Copy Markdown

Datadog Report

Branch report: simaoseica/RUM-9494/align-os-and-device-attributes
Commit report: 875e7a5
Test service: dd-sdk-ios

✅ 0 Failed, 2113 Passed, 1817 Skipped, 3m 19.02s Total duration (1m 53.96s time saved)

@simaoseica-dd
simaoseica-dd requested review from mariedm and maxep June 12, 2025 16:50
@simaoseica-dd
simaoseica-dd merged commit 5ba7485 into feature/v3 Jun 16, 2025
16 checks passed
@simaoseica-dd
simaoseica-dd deleted the simaoseica/RUM-9494/align-os-and-device-attributes branch June 16, 2025 08:35
@simaoseica-dd simaoseica-dd mentioned this pull request Aug 5, 2025
4 tasks
@simaoseica-dd simaoseica-dd mentioned this pull request Sep 2, 2025
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