File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
examples/default/src/screens/apm Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { Screen } from '../../components/Screen';
66import { VStack } from 'native-base' ;
77import { InputField } from '../../components/InputField' ;
88import { CustomButton } from '../../components/CustomButton' ;
9+ import BackgroundTimer from 'react-native-background-timer' ;
910
1011export const FlowsScreen : React . FC = ( ) => {
1112 const [ flowName , setFlowName ] = useState < string > ( '' ) ;
@@ -16,6 +17,12 @@ export const FlowsScreen: React.FC = () => {
1617 return APM . startFlow ( flowName ) ;
1718 }
1819
20+ async function startDelayedFlow ( ) {
21+ return BackgroundTimer . setTimeout ( ( ) => {
22+ APM . startFlow ( flowName ) ;
23+ } , 5000 ) ;
24+ }
25+
1926 function setFlowAttribute ( ) {
2027 return APM . setFlowAttribute ( flowName , flowAttributeKey , flowAttributeValue ) ;
2128 }
@@ -35,6 +42,7 @@ export const FlowsScreen: React.FC = () => {
3542 value = { flowName }
3643 />
3744 < CustomButton title = "Start Flow" onPress = { startFlow } />
45+ < CustomButton title = "Start 5s Delayed Flow" onPress = { startDelayedFlow } />
3846 < InputField
3947 placeholder = "Flows Attribute Key"
4048 onChangeText = { ( text ) => setFlowAttributeKey ( text ) }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { Screen } from '../../components/Screen';
66import { VStack } from 'native-base' ;
77import { InputField } from '../../components/InputField' ;
88import { CustomButton } from '../../components/CustomButton' ;
9+ import BackgroundTimer from 'react-native-background-timer' ;
910
1011export const TracesScreen : React . FC = ( ) => {
1112 const [ traceName , setTraceName ] = useState < string > ( '' ) ;
@@ -17,6 +18,12 @@ export const TracesScreen: React.FC = () => {
1718 executionTrace = await APM . startExecutionTrace ( traceName ?? '' ) ;
1819 }
1920
21+ async function startDelayedTrace ( ) {
22+ return BackgroundTimer . setTimeout ( async ( ) => {
23+ executionTrace = await APM . startExecutionTrace ( traceName ?? '' ) ;
24+ } , 5000 ) ;
25+ }
26+
2027 function setTraceAttribute ( ) {
2128 if ( ! executionTrace ) {
2229 console . log ( 'Please, start a trace before setting attributes.' ) ;
@@ -42,6 +49,7 @@ export const TracesScreen: React.FC = () => {
4249 value = { traceName }
4350 />
4451 < CustomButton title = "Start Trace" onPress = { startTrace } />
52+ < CustomButton title = "Start 5s Delayed Trace" onPress = { startDelayedTrace } />
4553 < InputField
4654 placeholder = "Trace Key Attribute"
4755 onChangeText = { ( text ) => setTraceAttributeKey ( text ) }
You can’t perform that action at this time.
0 commit comments