You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The automatic capture of network requests can be achieved in a few different ways depending on the platform and the networking library being used.
151
151
152
+
When initialization is done in JavaScript, always pass `enableNetworkInstrumentation: true` to `init(...)`. This is required on both iOS and Android.
153
+
152
154
#### iOS
153
155
154
156
When initializing via JS, pass `enableNetworkInstrumentation: true` as one of the options to `init`:
@@ -176,6 +178,21 @@ plugins {
176
178
177
179
To find the version to use, use the same version of the Capture SDK that is being used in the React Native project. Check the `build.gradle` file in the `node_modules/@bitdrift/react-native/android` directory for the version of the Capture SDK being used.
178
180
181
+
For Android, the plugin also needs instrumentation settings:
182
+
183
+
```gradle
184
+
capture {
185
+
instrumentation {
186
+
automaticOkHttpInstrumentation = true
187
+
okHttpInstrumentationType = OVERWRITE
188
+
}
189
+
}
190
+
```
191
+
192
+
`okHttpInstrumentationType` modes:
193
+
-`PROXY` (plugin default): preserves existing `EventListener.Factory` behavior in OkHttp clients.
194
+
-`OVERWRITE`: replaces the listener factory and can avoid duplicate network spans in some app setups.
195
+
179
196
In addition to this the plugin repository needs to be added to the `pluginManagement` block in the `settings.gradle` file:
180
197
181
198
```gradle
@@ -209,3 +226,26 @@ When using Expo to generate the project, this can be achieved by setting the `ne
209
226
}
210
227
}
211
228
```
229
+
230
+
The Android plugin mode can be configured with `okHttpInstrumentationType`:
231
+
232
+
```json
233
+
{
234
+
"expo": {
235
+
"plugins": [
236
+
[
237
+
"@bitdrift/react-native",
238
+
{
239
+
"networkInstrumentation": true,
240
+
"okHttpInstrumentationType": "OVERWRITE"
241
+
}
242
+
]
243
+
]
244
+
}
245
+
}
246
+
```
247
+
248
+
-`PROXY` (default): preserves existing `EventListener.Factory` behavior in OkHttp clients.
249
+
-`OVERWRITE`: replaces the listener factory and can avoid duplicate network spans in some app setups.
250
+
251
+
If you recently upgraded and started seeing duplicate spans on Android, set `okHttpInstrumentationType` to `OVERWRITE`.
0 commit comments