mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-25 19:41:20 -08:00
Add trackers info to sentry context
This commit is contained in:
1 parent
3996a60bf5
commit
83f76154ff
2 files changed
+23
-2
No files matched your search
@@ -4,7 +4,6 @@ import {
|
||||
Reducer,
|
||||
useContext,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useMemo,
|
||||
useReducer,
|
||||
useState,
|
||||
@@ -27,7 +26,7 @@ import { useDataFeedConfig } from './datafeed-config';
|
||||
import { useWebsocketAPI } from './websocket-api';
|
||||
import { error } from '@/utils/logging';
|
||||
import { cacheWrap } from './cache';
|
||||
import { getSentryOrCompute } from '@/utils/sentry';
|
||||
import { updateSentryContext } from '@/utils/sentry';
|
||||
|
||||
export interface FirmwareRelease {
|
||||
name: string;
|
||||
@@ -116,6 +115,10 @@ export function useProvideAppContext(): AppContext {
|
||||
dispatch({ type: 'datafeed', value: packet });
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
updateSentryContext(state);
|
||||
}, [state.datafeed?.devices])
|
||||
|
||||
useRPCPacket(RpcMessage.ResetResponse, ({ status, resetType }: ResetResponseT) => {
|
||||
if (!config?.feedbackSound) return;
|
||||
try {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
useLocation,
|
||||
useNavigationType,
|
||||
} from 'react-router-dom';
|
||||
import { AppState } from '@/hooks/app';
|
||||
|
||||
export function getSentryOrCompute(enabled = false) {
|
||||
// if sentry is already initialized - SKIP
|
||||
@@ -51,6 +52,7 @@ export function getSentryOrCompute(enabled = false) {
|
||||
// Session Replay
|
||||
replaysSessionSampleRate: import.meta.env.PROD ? 0.1 : 1.0, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
||||
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
|
||||
normalizeDepth: 8,
|
||||
enabled,
|
||||
});
|
||||
|
||||
@@ -62,3 +64,19 @@ export function getSentryOrCompute(enabled = false) {
|
||||
|
||||
return newClient;
|
||||
}
|
||||
|
||||
|
||||
export function updateSentryContext(state: AppState) {
|
||||
|
||||
// We filter out the shit we dont want. We dont need rotation data or ip addresses
|
||||
const trackers = (state.datafeed?.devices || []).map(({ hardwareInfo, trackers, id }) => ({
|
||||
id: id?.id,
|
||||
hardwareInfo: { ...hardwareInfo, ipAddress: undefined },
|
||||
trackers: trackers.map(({ info, trackerId }) => ({ info, trackerId: { trackerNum: trackerId?.trackerNum, deviceId: trackerId?.deviceId?.id } }))
|
||||
}))
|
||||
|
||||
// Will send the latest context to sentry when an error happens
|
||||
Sentry.setContext('trackers', {
|
||||
trackers
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user