Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: Removes deprecated Sentry.metrics API #4278

Merged
merged 5 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions samples/expo/app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,11 @@ import * as Sentry from '@sentry/react-native';

import { Text, View } from '@/components/Themed';
import { setScopeProperties } from '@/utils/setScopeProperties';
import { timestampInSeconds } from '@sentry/utils';
import React from 'react';

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

export default function TabOneScreen() {
const [componentMountStartTimestamp] = React.useState<number>(() => {
return timestampInSeconds();
});

React.useEffect(() => {
if (componentMountStartTimestamp) {
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
Sentry.metrics.distribution(
'tab_one_mount_time',
timestampInSeconds() - componentMountStartTimestamp,
{
unit: "seconds",
},
);
}
// We only want this to run once.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
<View style={styles.container}>
<Sentry.TimeToInitialDisplay record />
Expand All @@ -42,7 +22,6 @@ export default function TabOneScreen() {
<Button
title="Capture exception"
onPress={() => {
Sentry.metrics.increment('tab_one.capture_exception_button_press', 1);
Sentry.captureException(new Error('Captured exception'));
}}
/>
Expand Down
20 changes: 0 additions & 20 deletions samples/react-native-macos/src/Screens/ErrorsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,12 @@ import { setScopeProperties } from '../setScopeProperties';
import { StackNavigationProp } from '@react-navigation/stack';
import { UserFeedbackModal } from '../components/UserFeedbackModal';
import { FallbackRender } from '@sentry/react';
import { timestampInSeconds } from '@sentry/utils';

interface Props {
navigation: StackNavigationProp<any, 'HomeScreen'>;
}

const ErrorsScreen = (_props: Props) => {
const [componentMountStartTimestamp] = React.useState<number>(() => {
return timestampInSeconds();
});

React.useEffect(() => {
if (componentMountStartTimestamp) {
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
Sentry.metrics.distribution(
'home_mount_time',
timestampInSeconds() - componentMountStartTimestamp,
{
unit: 'seconds',
},
);
}
// We only want this to run once.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// Show bad code inside error boundary to trigger it.
const [showBadCode, setShowBadCode] = React.useState(false);
const [isFeedbackVisible, setFeedbackVisible] = React.useState(false);
Expand Down
3 changes: 0 additions & 3 deletions samples/react-native-macos/src/Screens/TrackerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const TrackerScreen = () => {
};

const onRefreshButtonPress = () => {
Sentry.metrics.increment('tracker_screen.refresh_button_press', 1, {
tags: { graph: 'none', public_data: true },
});
loadData();
};

Expand Down
20 changes: 0 additions & 20 deletions samples/react-native/src/Screens/ErrorsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { UserFeedbackModal } from '../components/UserFeedbackModal';
import { FallbackRender } from '@sentry/react';
import NativeSampleModule from '../../tm/NativeSampleModule';
import NativePlatformSampleModule from '../../tm/NativePlatformSampleModule';
import { timestampInSeconds } from '@sentry/utils';

const { AssetsModule, CppModule, CrashModule } = NativeModules;

Expand All @@ -28,25 +27,6 @@ interface Props {
}

const ErrorsScreen = (_props: Props) => {
const [componentMountStartTimestamp] = React.useState<number>(() => {
return timestampInSeconds();
});

React.useEffect(() => {
if (componentMountStartTimestamp) {
// Distributions help you get the most insights from your data by allowing you to obtain aggregations such as p90, min, max, and avg.
Sentry.metrics.distribution(
'home_mount_time',
timestampInSeconds() - componentMountStartTimestamp,
{
unit: 'seconds',
},
);
}
// We only want this to run once.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// Show bad code inside error boundary to trigger it.
const [showBadCode, setShowBadCode] = React.useState(false);
const [isFeedbackVisible, setFeedbackVisible] = React.useState(false);
Expand Down
3 changes: 0 additions & 3 deletions samples/react-native/src/Screens/TrackerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ const TrackerScreen = () => {
};

const onRefreshButtonPress = () => {
Sentry.metrics.increment('tracker_screen.refresh_button_press', 1, {
tags: { graph: 'none', public_data: true },
});
loadData();
};

Expand Down
Loading