Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ Middleware React Native Real User Monitoring SDK
Middleware React Native for Mobile supports React Native 0.68 and higher.

Since v2.0.0 the SDK wraps the stable Middleware native SDKs
(`io.github.middleware-labs:android-sdk` 3.0.2+ and the `MiddlewareRum`
CocoaPod 2.1+), which brings v3 session recording (rrweb replay), native
(`io.github.middleware-labs:android-sdk` 3.1.4+ and the `MiddlewareRum`
CocoaPod 2.2.2+), which brings v3 session recording (rrweb replay), native
crash/ANR reporting, and screen-name linked replays. Native toolchain
requirements:

Expand Down Expand Up @@ -308,8 +308,6 @@ const MiddlewareConfig: ReactNativeConfiguration = {
},
// Fraction of sessions that get recorded (0.0 - 1.0). Defaults to 1.0.
sessionSamplingRatio: 1.0,
// Fall back to the legacy (v2) screenshot recorder. v3 (rrweb replay) is the default.
disableSessionRecordingV3: false,
};
```

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
// Stable native SDK (main branch). 3.1.0 adds startRecording/stopRecording/isRecording.
implementation 'io.github.middleware-labs:android-sdk:3.1.2'
implementation 'io.github.middleware-labs:android-sdk:3.1.4'
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
// Compile-visible OTel for the JS-span reconstruction (SpanData etc.);
// runtime classes come transitively from android-sdk. Keep aligned with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ public ReadableMap getRecordingOptions() {
return Keys.RECORDING_OPTIONS.getMap(map);
}

public boolean getDisableSessionRecordingV3() {
return map.hasKey("disableSessionRecordingV3") && map.getBoolean("disableSessionRecordingV3");
}

public Double getSessionSamplingRatio() {
return map.hasKey("sessionSamplingRatio") ? map.getDouble("sessionSamplingRatio") : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ public void initialize(ReadableMap configMap, Promise promise) {
if (!Boolean.TRUE.toString().equals(sessionRecording)) {
builder.disableSessionRecording();
}
if (mapReader.getDisableSessionRecordingV3()) {
builder.disableSessionRecordingV3();
}
final Double samplingRatio = mapReader.getSessionSamplingRatio();
if (samplingRatio != null) {
builder.setSessionSamplingRatio(samplingRatio);
Expand Down
14 changes: 8 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ PODS:
- ReactCommon/turbomodule/core (= 0.73.1)
- fmt (6.2.1)
- glog (0.3.5)
- middleware-react-native (2.1.0):
- MiddlewareRum (~> 2.2)
- middleware-react-native (2.1.6):
- glog
- MiddlewareRum (~> 2.2.2)
- RCT-Folly (= 2022.05.16.00)
- React-Core
- MiddlewareRum (2.2.0):
- MiddlewareRum (2.2.2):
- DeviceKit (~> 5.4)
- PLCrashReporter (~> 1.11)
- Reachability (~> 3.7)
Expand Down Expand Up @@ -1264,8 +1266,8 @@ SPEC CHECKSUMS:
FBReactNativeSpec: df0ebe69acd14ce0be0269cf75b6e338a727259b
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
middleware-react-native: 6052a2e9035f41589a46a89e742c09f2af1511e4
MiddlewareRum: 898c83793cc710d68d8b124d6a9e1be1095153a4
middleware-react-native: f075d12bae4af81059b646ae2c2be033de2ac42b
MiddlewareRum: c7287f0a65cbe83a043ae5d0f433d6563b74fab8
PLCrashReporter: db59ef96fa3d25f3650040d02ec2798cffee75f2
RCT-Folly: cd21f1661364f975ae76b3308167ad66b09f53f5
RCTRequired: 6dda55e483f75d2b43781d8ad5bd7df276a50981
Expand Down Expand Up @@ -1317,6 +1319,6 @@ SPEC CHECKSUMS:
SwiftProtobuf: b109bd17979d7993a84da14b1e1fdd8b0ded934a
Yoga: 4f53dc50008d626fa679c7a1cb4bed898f8c0bde

PODFILE CHECKSUM: a820c5f655f7733be8c7de79270e7241d08295e7
PODFILE CHECKSUM: 4d5c450dd208d07f681cab2179a482c80dd4cb07

COCOAPODS: 1.17.0
3 changes: 0 additions & 3 deletions ios/MiddlewareReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ class MiddlewareReactNative: NSObject {
if (config["sessionRecording"] as? String) != "true" {
_ = builder.disableRecording()
}
if config["disableSessionRecordingV3"] as? Bool == true {
_ = builder.disableSessionRecordingV3()
}
if let recordingOptions = config["recordingOptions"] as? [String: Any] {
_ = builder.recordingOptions(mapRecordingOptions(recordingOptions))
}
Expand Down
2 changes: 1 addition & 1 deletion middleware-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|

# Stable native SDK (2.1+ adds setNativeSession + exportRawSpans); brings
# PLCrashReporter/DeviceKit/SwiftProtobuf/SWCompression/Reachability transitively.
s.dependency "MiddlewareRum", "~> 2.2"
s.dependency "MiddlewareRum", "~> 2.2.2"

# React dependencies. `install_modules_dependencies` (react_native_pods.rb,
# RN >= 0.71) wires the right pods for whichever architecture the host app
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@middleware.io/middleware-react-native",
"version": "2.1.5",
"version": "2.1.6",
"description": "Middleware React Native real user monitoring SDK",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
30 changes: 4 additions & 26 deletions src/middlewareRum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ export interface ReactNativeConfiguration {
serviceName: string;
projectName: string;
sessionRecording?: boolean;
/** Options for v3 session recording (rrweb screenshot events). */
/** Options for session recording (rrweb screenshot events). */
recordingOptions?: RecordingOptions;
/** Falls back to the legacy (v2) screenshot recorder when true. */
disableSessionRecordingV3?: boolean;
/** Fraction of sessions to sample for traces + recordings, 0.0–1.0. */
sessionSamplingRatio?: number;
deploymentEnvironment?: string;
Expand Down Expand Up @@ -163,11 +161,10 @@ let appStartInfo: AppStartInfo | null = null;
let isInitialized = false;

// Live recording state, mirrored onto the provider resource so exported spans
// always carry the current `recording`/`recordingV3` values. Recording can be
// toggled at runtime, and these attributes are what tell the backend a session
// has a replay to play back.
// always carry the current `recording` value. Recording can be toggled at
// runtime, and this attribute is what tells the backend a session has a replay
// to play back.
let isRecordingActive = false;
let isRecordingV3Configured = true;

const updateLocation = (latitude: number, longitude: number) => {
setGlobalAttributes({
Expand Down Expand Up @@ -249,22 +246,14 @@ export const MiddlewareRum: MiddlewareRumType = {
}

isRecordingActive = sessionRecording === 'true';
isRecordingV3Configured = !config.disableSessionRecordingV3;

const recordingAttr = sessionRecording === 'true' ? '1' : '0';
// recordingV3 routes bifrost to the rrweb player; matches the native
// SDKs' resource attribute (v3 is on by default when recording is on).
const recordingV3Attr =
sessionRecording === 'true' && !config.disableSessionRecordingV3
? '1'
: '0';
const resourceAttributes = {
...getResource(),
[SemanticResourceAttributes.SERVICE_NAME]: config.serviceName,
'project.name': config.projectName,
'env': config.deploymentEnvironment,
'recording': recordingAttr,
'recordingV3': recordingV3Attr,
'session.id': getSessionId(),
'session.start_time': getSessionStartTime(),
};
Expand All @@ -283,9 +272,6 @@ export const MiddlewareRum: MiddlewareRumType = {
...(config.sessionSamplingRatio !== undefined && {
sessionSamplingRatio: config.sessionSamplingRatio,
}),
...(config.disableSessionRecordingV3 !== undefined && {
disableSessionRecordingV3: config.disableSessionRecordingV3,
}),
...(config.recordingOptions !== undefined && {
recordingOptions: config.recordingOptions,
}),
Expand Down Expand Up @@ -326,14 +312,6 @@ export const MiddlewareRum: MiddlewareRumType = {
enumerable: true,
});

Object.defineProperty(provider.resource.attributes, 'recordingV3', {
get() {
return isRecordingActive && isRecordingV3Configured ? '1' : '0';
},
configurable: true,
enumerable: true,
});

// The OTLP options are only used if the native module is missing; on a
// normal build the native SDK still owns the pipeline.
provider.addSpanProcessor(
Expand Down
1 change: 0 additions & 1 deletion src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export interface NativeSdKConfiguration {
projectName: string;
deploymentEnvironment?: string;
sessionSamplingRatio?: number;
disableSessionRecordingV3?: boolean;
recordingOptions?: {
frequency?: string;
quality?: string;
Expand Down
Loading