Skip to content

Commit fc77bcd

Browse files
diegomtz5claude
andcommitted
Use platformVersion for session replay instrumentation fields
Updates session replay to report correct platform information for hybrid agents: - instrumentation.name: Uses platform-aware logic (native vs hybrid) - instrumentation.version: Uses platformVersion with fallback to agentVersion - Matches NRLogger pattern for consistent reporting across all data types This ensures hybrid agents (React Native, Flutter, Capacitor, etc.) are correctly identified with their platform version in session replay data. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 48e0b7f commit fc77bcd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Agent/SessionReplay/SessionReplayReporter.swift

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,25 @@ public class SessionReplayReporter: NSObject {
166166
"replay.lastTimestamp": String(Int(lastTimestamp)),
167167
"appVersion": appVersion,
168168
"instrumentation.provider": "mobile",
169-
"instrumentation.name": NewRelicInternalUtils.osName(),
170-
"instrumentation.version": NewRelicInternalUtils.agentVersion(),
171-
"collector.name": NewRelicInternalUtils.osName()
169+
"instrumentation.name": {
170+
guard let connectionInfo = NRMAAgentConfiguration.connectionInformation(),
171+
let deviceInfo = connectionInfo.deviceInformation else {
172+
return NewRelicInternalUtils.agentName()
173+
}
174+
let platform = deviceInfo.platform
175+
return platform.rawValue == 0 // NRMAPlatform_Native
176+
? NewRelicInternalUtils.agentName()
177+
: NewRelicInternalUtils.string(from: platform)
178+
}(),
179+
"instrumentation.version": {
180+
guard let connectionInfo = NRMAAgentConfiguration.connectionInformation(),
181+
let deviceInfo = connectionInfo.deviceInformation,
182+
let platformVersion = deviceInfo.platformVersion as String? else {
183+
return NewRelicInternalUtils.agentVersion()
184+
}
185+
return platformVersion
186+
}(),
187+
"collector.name": NewRelicInternalUtils.agentName()
172188
]
173189
if isGZipped {
174190
attributes["content_encoding"] = "gzip"

0 commit comments

Comments
 (0)