|
11 | 11 | import com.instabug.apm.configuration.cp.FeatureAvailabilityCallback;
|
12 | 12 | import com.instabug.apm.model.ExecutionTrace;
|
13 | 13 | import com.instabug.apm.networking.APMNetworkLogger;
|
| 14 | +import com.instabug.apm.networkinterception.cp.APMCPNetworkLog; |
14 | 15 | import com.instabug.flutter.generated.ApmPigeon;
|
15 | 16 | import com.instabug.flutter.util.Reflection;
|
16 | 17 | import com.instabug.flutter.util.ThreadManager;
|
17 | 18 | import com.instabug.apm.networkinterception.cp.APMCPNetworkLog;
|
18 | 19 |
|
19 | 20 | import io.flutter.plugin.common.BinaryMessenger;
|
20 | 21 |
|
21 |
| -import org.jetbrains.annotations.NotNull; |
22 | 22 | import org.json.JSONObject;
|
23 | 23 |
|
24 | 24 | import java.lang.reflect.Method;
|
@@ -210,10 +210,54 @@ public void networkLogAndroid(@NonNull Map<String, Object> data) {
|
210 | 210 | if (data.containsKey("serverErrorMessage")) {
|
211 | 211 | serverErrorMessage = (String) data.get("serverErrorMessage");
|
212 | 212 | }
|
| 213 | + Boolean isW3cHeaderFound = null; |
| 214 | + Number partialId = null; |
| 215 | + Number networkStartTimeInSeconds = null; |
| 216 | + String w3CGeneratedHeader = null; |
| 217 | + String w3CCaughtHeader = null; |
| 218 | + |
| 219 | + if (data.containsKey("isW3cHeaderFound")) { |
| 220 | + isW3cHeaderFound = (Boolean) data.get("isW3cHeaderFound"); |
| 221 | + } |
| 222 | + |
| 223 | + if (data.containsKey("partialId")) { |
| 224 | + |
| 225 | + |
| 226 | + partialId = ((Number) data.get("partialId")); |
| 227 | + |
| 228 | + } |
| 229 | + if (data.containsKey("networkStartTimeInSeconds")) { |
| 230 | + networkStartTimeInSeconds = ((Number) data.get("networkStartTimeInSeconds")); |
| 231 | + } |
| 232 | + |
| 233 | + if (data.containsKey("w3CGeneratedHeader")) { |
| 234 | + |
| 235 | + w3CGeneratedHeader = (String) data.get("w3CGeneratedHeader"); |
| 236 | + |
| 237 | + } |
| 238 | + |
| 239 | + |
| 240 | + if (data.containsKey("w3CCaughtHeader")) { |
| 241 | + w3CCaughtHeader = (String) data.get("w3CCaughtHeader"); |
| 242 | + |
| 243 | + } |
| 244 | + |
| 245 | + |
| 246 | + APMCPNetworkLog.W3CExternalTraceAttributes w3cExternalTraceAttributes = |
| 247 | + null; |
| 248 | + if (isW3cHeaderFound != null) { |
| 249 | + w3cExternalTraceAttributes = new APMCPNetworkLog.W3CExternalTraceAttributes( |
| 250 | + isW3cHeaderFound, partialId == null ? null : partialId.longValue(), |
| 251 | + networkStartTimeInSeconds == null ? null : networkStartTimeInSeconds.longValue(), |
| 252 | + w3CGeneratedHeader, w3CCaughtHeader |
| 253 | + |
| 254 | + ); |
| 255 | + } |
| 256 | + |
213 | 257 |
|
214 | 258 | Method method = Reflection.getMethod(Class.forName("com.instabug.apm.networking.APMNetworkLogger"), "log", long.class, long.class, String.class, String.class, long.class, String.class, String.class, String.class, String.class, String.class, long.class, int.class, String.class, String.class, String.class, String.class, APMCPNetworkLog.W3CExternalTraceAttributes.class);
|
215 | 259 | if (method != null) {
|
216 |
| - method.invoke(apmNetworkLogger, requestStartTime, requestDuration, requestHeaders, requestBody, requestBodySize, requestMethod, requestUrl, requestContentType, responseHeaders, responseBody, responseBodySize, statusCode, responseContentType, errorMessage, gqlQueryName, serverErrorMessage, null); |
| 260 | + method.invoke(apmNetworkLogger, requestStartTime, requestDuration, requestHeaders, requestBody, requestBodySize, requestMethod, requestUrl, requestContentType, responseHeaders, responseBody, responseBodySize, statusCode, responseContentType, errorMessage, gqlQueryName, serverErrorMessage, w3cExternalTraceAttributes); |
217 | 261 | } else {
|
218 | 262 | Log.e(TAG, "APMNetworkLogger.log was not found by reflection");
|
219 | 263 | }
|
|
0 commit comments