Commit e7e74ca4 authored by Frédéric Caplette's avatar Frédéric Caplette Committed by Jose Ivan Vargas

Modify sentry for big pipeline graph

parent 6450fd5d
...@@ -7,7 +7,7 @@ import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; ...@@ -7,7 +7,7 @@ import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { DEFAULT, DRAW_FAILURE, LOAD_FAILURE } from '../../constants'; import { DEFAULT, DRAW_FAILURE, LOAD_FAILURE } from '../../constants';
import DismissPipelineGraphCallout from '../../graphql/mutations/dismiss_pipeline_notification.graphql'; import DismissPipelineGraphCallout from '../../graphql/mutations/dismiss_pipeline_notification.graphql';
import getUserCallouts from '../../graphql/queries/get_user_callouts.query.graphql'; import getUserCallouts from '../../graphql/queries/get_user_callouts.query.graphql';
import { reportToSentry } from '../../utils'; import { reportToSentry, reportMessageToSentry } from '../../utils';
import { listByLayers } from '../parsing_utils'; import { listByLayers } from '../parsing_utils';
import { IID_FAILURE, LAYER_VIEW, STAGE_VIEW, VIEW_TYPE_KEY } from './constants'; import { IID_FAILURE, LAYER_VIEW, STAGE_VIEW, VIEW_TYPE_KEY } from './constants';
import PipelineGraph from './graph_component.vue'; import PipelineGraph from './graph_component.vue';
...@@ -109,14 +109,16 @@ export default { ...@@ -109,14 +109,16 @@ export default {
}, },
error(err) { error(err) {
this.reportFailure({ type: LOAD_FAILURE, skipSentry: true }); this.reportFailure({ type: LOAD_FAILURE, skipSentry: true });
reportToSentry(
reportMessageToSentry(
this.$options.name, this.$options.name,
`| type: ${LOAD_FAILURE} | `| type: ${LOAD_FAILURE} , info: ${serializeLoadErrors(err)}`,
| rawError: ${JSON.stringify(err)} | {
| info: ${serializeLoadErrors(err)} | projectPath: this.projectPath,
| graphqlResourceEtag: ${this.graphqlResourceEtag} | pipelineIid: this.pipelineIid,
| projectPath: ${this.projectPath} | pipelineStages: this.pipeline?.stages?.length || 0,
| iid: ${this.pipelineIid} |`, nbOfDownstreams: this.pipeline?.downstream?.length || 0,
},
); );
}, },
result({ error }) { result({ error }) {
......
import { isEmpty } from 'lodash';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import { unwrapStagesWithNeedsAndLookup } from '../unwrapping_utils'; import { unwrapStagesWithNeedsAndLookup } from '../unwrapping_utils';
...@@ -39,15 +40,15 @@ const serializeGqlErr = (gqlError) => { ...@@ -39,15 +40,15 @@ const serializeGqlErr = (gqlError) => {
const serializeLoadErrors = (errors) => { const serializeLoadErrors = (errors) => {
const { gqlError, graphQLErrors, networkError, message } = errors; const { gqlError, graphQLErrors, networkError, message } = errors;
if (graphQLErrors) { if (!isEmpty(graphQLErrors)) {
return graphQLErrors.map((err) => serializeGqlErr(err)).join('; '); return graphQLErrors.map((err) => serializeGqlErr(err)).join('; ');
} }
if (gqlError) { if (!isEmpty(gqlError)) {
return serializeGqlErr(gqlError); return serializeGqlErr(gqlError);
} }
if (networkError) { if (!isEmpty(networkError)) {
return `Network error: ${networkError.message}`; return `Network error: ${networkError.message}`;
} }
......
...@@ -73,3 +73,12 @@ export const reportToSentry = (component, failureType) => { ...@@ -73,3 +73,12 @@ export const reportToSentry = (component, failureType) => {
Sentry.captureException(failureType); Sentry.captureException(failureType);
}); });
}; };
export const reportMessageToSentry = (component, message, context) => {
Sentry.withScope((scope) => {
// eslint-disable-next-line @gitlab/require-i18n-strings
scope.setContext('Vue data', context);
scope.setTag('component', component);
Sentry.captureMessage(message);
});
};
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