Skip to content

Commit 918c462

Browse files
feat(example): add apm screen (#1141)
1 parent ab2cb9f commit 918c462

File tree

4 files changed

+7
-71
lines changed

4 files changed

+7
-71
lines changed

CHANGELOG.md

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
# Changelog
22

3-
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v13.3.0...dev)
4-
5-
### Added
6-
7-
- Add support for Expo Router navigation tracking ([#1270](https://github.com/Instabug/Instabug-React-Native/pull/1270)).
8-
9-
## [13.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.2.0...v13.3.0) (August 4, 2024)
10-
11-
### Added
12-
13-
- Add support for Feature Flags APIs `Instabug.addFeatureFlags`, `Instabug.removeFeatureFlags` and `Instabug.clearAllFeatureFlags` ([#1230](https://github.com/Instabug/Instabug-React-Native/pull/1230)).
14-
- Export `uploadSourcemaps` and `uploadSoFiles` utilities in the `instabug-reactnative/upload` sub-package for usage in custom Node.js upload scripts ([#1252](https://github.com/Instabug/Instabug-React-Native/pull/1252)).
15-
16-
### Changed
17-
18-
- Bump Instabug Android SDK to v13.3.0 ([#1261](https://github.com/Instabug/Instabug-React-Native/pull/1261)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v13.3.0).
19-
- Bump Instabug iOS SDK to v13.3.0 ([#1262](https://github.com/Instabug/Instabug-React-Native/pull/1262)). [See release notes](https://github.com/Instabug/Instabug-iOS/releases/tag/13.3.0).
20-
21-
### Deprecated
22-
23-
- Deprecate Experiments APIs `Instabug.addExperiments`, `Instabug.removeExperiments` and `Instabug.clearAllExperiments` in favor of the new Feature Flags APIs ([#1230](https://github.com/Instabug/Instabug-React-Native/pull/1230)).
24-
25-
### Fixed
26-
27-
- Fix APM network logging on Android ([#1253](https://github.com/Instabug/Instabug-React-Native/pull/1253)).
28-
- Fix an OOM (out-of-memory) crash while saving network logs on Android ([#1244](https://github.com/Instabug/Instabug-React-Native/pull/1244)).
29-
303
## [13.2.0](https://github.com/Instabug/Instabug-React-Native/compare/v13.1.1...v13.2.0) (July 7, 2024)
314

325
### Changed
@@ -79,20 +52,8 @@
7952
- Bump Instabug iOS SDK to v13.0.0 ([#1189](https://github.com/Instabug/Instabug-React-Native/pull/1189)). [See release notes](https://github.com/instabug/instabug-ios/releases/tag/13.0.0).
8053
- Bump Instabug Android SDK to v13.0.0 ([#1188](https://github.com/Instabug/Instabug-React-Native/pull/1188)). [See release notes](https://github.com/Instabug/android/releases/tag/v13.0.0).
8154

82-
<<<<<<< HEAD
83-
84-
## [12.9.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.8.0...v12.9.0) (April 2, 2024)
85-
86-
=======
87-
88-
### Deprecated
89-
90-
- Deprecate Execution Traces APIs `APM.startExecutionTrace`, `Trace.end` and `Trace.setAttribute` in favor of the new App Flows APIs ([#1138](https://github.com/Instabug/Instabug-React-Native/pull/1138)).
91-
9255
## [12.9.0](https://github.com/Instabug/Instabug-React-Native/compare/v12.8.0...12.9.0)(April 2, 2024)
9356

94-
> > > > > > > origin/dev
95-
9657
### Added
9758

9859
- Adds symbol files upload script ([#1137](https://github.com/Instabug/Instabug-React-Native/pull/1137))
@@ -103,6 +64,10 @@
10364

10465
- Deprecate execution traces APIs `APM.startExecutionTrace`, `Trace.end` and `Trace.setFlowAttribute` in favor of the new app flow APIs ([#1138](https://github.com/Instabug/Instabug-React-Native/pull/1138)).
10566

67+
### Deprecated
68+
69+
- Deprecate Execution Traces APIs `APM.startExecutionTrace`, `Trace.end` and `Trace.setAttribute` in favor of the new App Flows APIs ([#1138](https://github.com/Instabug/Instabug-React-Native/pull/1138)).
70+
10671
### Changed
10772

10873
- Bump Instabug Android SDK to v12.9.0 ([#1168](https://github.com/Instabug/Instabug-React-Native/pull/1168)). [See release notes](https://github.com/Instabug/android/releases/tag/v12.9.0).

examples/default/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"@react-navigation/native-stack": "^6.9.12",
1818
"graphql": "^16.8.1",
1919
"graphql-request": "^6.1.0",
20-
"axios": "^1.7.2",
2120
"instabug-reactnative": "link:../..",
2221
"instabug-reactnative-ndk": "github:https://github.com/Instabug/Instabug-React-Native-NDK",
2322
"native-base": "^3.4.28",

examples/default/src/App.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
22
import { StyleSheet } from 'react-native';
33

44
import { GestureHandlerRootView } from 'react-native-gesture-handler';
5-
import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
5+
import { NavigationContainer } from '@react-navigation/native';
66
import Instabug, {
77
CrashReporting,
88
InvocationEvent,
@@ -20,7 +20,6 @@ import { QueryClient, QueryClientProvider } from 'react-query';
2020
const queryClient = new QueryClient();
2121

2222
export const App: React.FC = () => {
23-
const navigationRef = useNavigationContainerRef();
2423
useEffect(() => {
2524
Instabug.init({
2625
token: 'deb1910a7342814af4e4c9210c786f35',
@@ -34,17 +33,11 @@ export const App: React.FC = () => {
3433
});
3534
}, []);
3635

37-
useEffect(() => {
38-
const unregisterListener = Instabug.setNavigationListener(navigationRef);
39-
40-
return unregisterListener;
41-
}, [navigationRef]);
42-
4336
return (
4437
<GestureHandlerRootView style={styles.root}>
4538
<NativeBaseProvider theme={nativeBaseTheme}>
4639
<QueryClientProvider client={queryClient}>
47-
<NavigationContainer theme={navigationTheme} ref={navigationRef}>
40+
<NavigationContainer onStateChange={Instabug.onStateChange} theme={navigationTheme}>
4841
<RootTabNavigator />
4942
</NavigationContainer>
5043
</QueryClientProvider>

examples/default/src/screens/apm/APMScreen.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
1-
import React from 'react';
21
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
3-
import axios from 'axios';
4-
52
import type { HomeStackParamList } from '../../navigation/HomeStack';
3+
import React from 'react';
64
import { ListTile } from '../../components/ListTile';
75
import { Screen } from '../../components/Screen';
8-
import { NativeAPM } from '../../../../../src/native/NativeAPM';
96

107
export const APMScreen: React.FC<NativeStackScreenProps<HomeStackParamList, 'APM'>> = ({
118
navigation,
129
}) => {
13-
const simulateNetworkRequest = () => {
14-
axios.get('https://httpbin.org/anything', {
15-
headers: { traceparent: 'Caught Header Example' },
16-
});
17-
};
18-
const simulateNetworkRequestWithoutHeader = () => {
19-
axios.get('https://httpbin.org/anything');
20-
};
2110
return (
2211
<Screen>
23-
<ListTile title="Enable APM" onPress={() => NativeAPM.setEnabled(true)} />
24-
<ListTile title="Disable APM" onPress={() => NativeAPM.setEnabled(false)} />
25-
<ListTile
26-
title="Simulate Network Request With Header"
27-
onPress={() => simulateNetworkRequest()}
28-
/>
29-
<ListTile
30-
title="Simulate Network Request"
31-
onPress={() => simulateNetworkRequestWithoutHeader()}
32-
/>
3312
<ListTile title="Network Screen" onPress={() => navigation.navigate('NetworkTraces')} />
3413
<ListTile title="Traces" onPress={() => navigation.navigate('ExecutionTraces')} />
3514
<ListTile title="Flows" onPress={() => navigation.navigate('AppFlows')} />

0 commit comments

Comments
 (0)