Skip to content

Commit b53dbe6

Browse files
misc: Removes deprecated Sentry.metrics API (#4278)
* Remove metric from the Expo app * Remove metric from the MacOS app * Remove metric from the RN app --------- Co-authored-by: LucasZF <lucas-zimerman1@hotmail.com>
1 parent c686700 commit b53dbe6

File tree

5 files changed

+0
-67
lines changed

5 files changed

+0
-67
lines changed

samples/expo/app/(tabs)/index.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,11 @@ import * as Sentry from '@sentry/react-native';
44

55
import { Text, View } from '@/components/Themed';
66
import { setScopeProperties } from '@/utils/setScopeProperties';
7-
import { timestampInSeconds } from '@sentry/utils';
87
import React from 'react';
98

109
const isRunningInExpoGo = Constants.appOwnership === 'expo'
1110

1211
export default function TabOneScreen() {
13-
const [componentMountStartTimestamp] = React.useState<number>(() => {
14-
return timestampInSeconds();
15-
});
16-
17-
React.useEffect(() => {
18-
if (componentMountStartTimestamp) {
19-
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
20-
Sentry.metrics.distribution(
21-
'tab_one_mount_time',
22-
timestampInSeconds() - componentMountStartTimestamp,
23-
{
24-
unit: "seconds",
25-
},
26-
);
27-
}
28-
// We only want this to run once.
29-
// eslint-disable-next-line react-hooks/exhaustive-deps
30-
}, []);
31-
3212
return (
3313
<View style={styles.container}>
3414
<Sentry.TimeToInitialDisplay record />
@@ -42,7 +22,6 @@ export default function TabOneScreen() {
4222
<Button
4323
title="Capture exception"
4424
onPress={() => {
45-
Sentry.metrics.increment('tab_one.capture_exception_button_press', 1);
4625
Sentry.captureException(new Error('Captured exception'));
4726
}}
4827
/>

samples/react-native-macos/src/Screens/ErrorsScreen.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,12 @@ import { setScopeProperties } from '../setScopeProperties';
1515
import { StackNavigationProp } from '@react-navigation/stack';
1616
import { UserFeedbackModal } from '../components/UserFeedbackModal';
1717
import { FallbackRender } from '@sentry/react';
18-
import { timestampInSeconds } from '@sentry/utils';
1918

2019
interface Props {
2120
navigation: StackNavigationProp<any, 'HomeScreen'>;
2221
}
2322

2423
const ErrorsScreen = (_props: Props) => {
25-
const [componentMountStartTimestamp] = React.useState<number>(() => {
26-
return timestampInSeconds();
27-
});
28-
29-
React.useEffect(() => {
30-
if (componentMountStartTimestamp) {
31-
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
32-
Sentry.metrics.distribution(
33-
'home_mount_time',
34-
timestampInSeconds() - componentMountStartTimestamp,
35-
{
36-
unit: 'seconds',
37-
},
38-
);
39-
}
40-
// We only want this to run once.
41-
// eslint-disable-next-line react-hooks/exhaustive-deps
42-
}, []);
43-
4424
// Show bad code inside error boundary to trigger it.
4525
const [showBadCode, setShowBadCode] = React.useState(false);
4626
const [isFeedbackVisible, setFeedbackVisible] = React.useState(false);

samples/react-native-macos/src/Screens/TrackerScreen.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ const TrackerScreen = () => {
5353
};
5454

5555
const onRefreshButtonPress = () => {
56-
Sentry.metrics.increment('tracker_screen.refresh_button_press', 1, {
57-
tags: { graph: 'none', public_data: true },
58-
});
5956
loadData();
6057
};
6158

samples/react-native/src/Screens/ErrorsScreen.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { UserFeedbackModal } from '../components/UserFeedbackModal';
1919
import { FallbackRender } from '@sentry/react';
2020
import NativeSampleModule from '../../tm/NativeSampleModule';
2121
import NativePlatformSampleModule from '../../tm/NativePlatformSampleModule';
22-
import { timestampInSeconds } from '@sentry/utils';
2322

2423
const { AssetsModule, CppModule, CrashModule } = NativeModules;
2524

@@ -28,25 +27,6 @@ interface Props {
2827
}
2928

3029
const ErrorsScreen = (_props: Props) => {
31-
const [componentMountStartTimestamp] = React.useState<number>(() => {
32-
return timestampInSeconds();
33-
});
34-
35-
React.useEffect(() => {
36-
if (componentMountStartTimestamp) {
37-
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
38-
Sentry.metrics.distribution(
39-
'home_mount_time',
40-
timestampInSeconds() - componentMountStartTimestamp,
41-
{
42-
unit: 'seconds',
43-
},
44-
);
45-
}
46-
// We only want this to run once.
47-
// eslint-disable-next-line react-hooks/exhaustive-deps
48-
}, []);
49-
5030
// Show bad code inside error boundary to trigger it.
5131
const [showBadCode, setShowBadCode] = React.useState(false);
5232
const [isFeedbackVisible, setFeedbackVisible] = React.useState(false);

samples/react-native/src/Screens/TrackerScreen.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ const TrackerScreen = () => {
5353
};
5454

5555
const onRefreshButtonPress = () => {
56-
Sentry.metrics.increment('tracker_screen.refresh_button_press', 1, {
57-
tags: { graph: 'none', public_data: true },
58-
});
5956
loadData();
6057
};
6158

0 commit comments

Comments
 (0)