fix(governance): more thorough catch for url in error reporting (#3686)
This commit is contained in:
parent
d44392bebf
commit
b4c7dc6f59
@ -2,7 +2,6 @@ import './i18n';
|
|||||||
|
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import * as Sentry from '@sentry/react';
|
import * as Sentry from '@sentry/react';
|
||||||
import { Integrations } from '@sentry/tracing';
|
|
||||||
import { BrowserRouter as Router, useLocation } from 'react-router-dom';
|
import { BrowserRouter as Router, useLocation } from 'react-router-dom';
|
||||||
import { AppLoader } from './app-loader';
|
import { AppLoader } from './app-loader';
|
||||||
import { NetworkInfo } from '@vegaprotocol/network-info';
|
import { NetworkInfo } from '@vegaprotocol/network-info';
|
||||||
@ -184,6 +183,10 @@ const ScrollToTop = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeQueryParams = (url: string) => {
|
||||||
|
return url.split('?')[0];
|
||||||
|
};
|
||||||
|
|
||||||
const AppContainer = () => {
|
const AppContainer = () => {
|
||||||
const { config, loading, error } = useEthereumConfig();
|
const { config, loading, error } = useEthereumConfig();
|
||||||
const {
|
const {
|
||||||
@ -204,22 +207,46 @@ const AppContainer = () => {
|
|||||||
if (ENV.dsn && telemetryOn) {
|
if (ENV.dsn && telemetryOn) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: ENV.dsn,
|
dsn: ENV.dsn,
|
||||||
integrations: [new Integrations.BrowserTracing()],
|
|
||||||
tracesSampleRate: 0.1,
|
tracesSampleRate: 0.1,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
environment: VEGA_ENV,
|
environment: VEGA_ENV,
|
||||||
release: GIT_COMMIT_HASH,
|
release: GIT_COMMIT_HASH,
|
||||||
beforeSend(event) {
|
beforeSend(event) {
|
||||||
if (event.request?.url?.includes('/claim?')) {
|
const requestUrl = event.request?.url;
|
||||||
return {
|
const transaction = event.transaction;
|
||||||
...event,
|
|
||||||
request: {
|
const updatedRequest =
|
||||||
...event.request,
|
requestUrl && requestUrl.includes('/test?')
|
||||||
url: event.request?.url.split('?')[0],
|
? { ...event.request, url: removeQueryParams(requestUrl) }
|
||||||
},
|
: event.request;
|
||||||
};
|
|
||||||
}
|
const updatedTransaction =
|
||||||
return event;
|
transaction && transaction.includes('/test?')
|
||||||
|
? removeQueryParams(transaction)
|
||||||
|
: transaction;
|
||||||
|
|
||||||
|
const updatedBreadcrumbs = event.breadcrumbs?.map((breadcrumb) => {
|
||||||
|
if (
|
||||||
|
breadcrumb.type === 'navigation' &&
|
||||||
|
breadcrumb.data?.to?.includes('/test?')
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
...breadcrumb,
|
||||||
|
data: {
|
||||||
|
...breadcrumb.data,
|
||||||
|
to: removeQueryParams(breadcrumb.data.to),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return breadcrumb;
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
...event,
|
||||||
|
request: updatedRequest,
|
||||||
|
transaction: updatedTransaction,
|
||||||
|
breadcrumbs: updatedBreadcrumbs ?? event.breadcrumbs,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Sentry.setTag('branch', GIT_BRANCH);
|
Sentry.setTag('branch', GIT_BRANCH);
|
||||||
|
Loading…
Reference in New Issue
Block a user