Commit 906e9441 authored by Simon Knox's avatar Simon Knox

Merge branch 'jivanvl-add-sentry-report-job-actions' into 'master'

Add Sentry reporting to job log actions

See merge request gitlab-org/gitlab!67447
parents 709b954e 8784dedb
......@@ -13,6 +13,7 @@ import {
scrollUp,
} from '~/lib/utils/scroll_utils';
import { __ } from '~/locale';
import { reportToSentry } from '../utils';
import * as types from './mutation_types';
export const init = ({ dispatch }, { endpoint, logState, pagePath }) => {
......@@ -175,11 +176,14 @@ export const fetchTrace = ({ dispatch, state }) =>
dispatch('startPollingTrace');
}
})
.catch((e) =>
e.response.status === httpStatusCodes.FORBIDDEN
? dispatch('receiveTraceUnauthorizedError')
: dispatch('receiveTraceError'),
);
.catch((e) => {
if (e.response.status === httpStatusCodes.FORBIDDEN) {
dispatch('receiveTraceUnauthorizedError');
} else {
reportToSentry('job_actions', e);
dispatch('receiveTraceError');
}
});
export const startPollingTrace = ({ dispatch, commit }) => {
const traceTimeout = setTimeout(() => {
......
import * as Sentry from '@sentry/browser';
/**
* capture anything starting with http:// or https://
* https?:\/\/
......@@ -10,3 +12,10 @@
*/
export const linkRegex = /(https?:\/\/[^"<>()\\^`{|}\s]+[^"<>()\\^`{|}\s.,:;!?])/g;
export default { linkRegex };
export const reportToSentry = (component, failureType) => {
Sentry.withScope((scope) => {
scope.setTag('component', component);
Sentry.captureException(failureType);
});
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment