Misc. of sentry improvements (#12233)
This PR mixes various initiatives to improve visibility on sentry **1. Catch errors on workflow jobs** commit [catch workflowTriggerExceptions in job handle](1dbba8c9e2) @thomtrp **2. Fix type in messagingImportExceptionHandler** commit [fix type issue on messagingImportExceptionHandler](919bb3844c) @guillim **3. Catch invalid uuid errors thrown by Postgres by rightfully typing expected id as uuid** commits [use UUIDFilter instead of IDFilter to get graphqlError in case of malformed id](57cc315efe), [use UUIDFilter (2)](304553d770), [fix ids typed as UUID instead of ID](f95d6319cf) @Weiko ⚠️⚠️⚠️ when we deploy this PR we need to flush the schema types from redis as this PR changes them ⚠️⚠️⚠️ **4. Do not group UNKNOWN errors together** commit [do not group unknown errors together](c299b39c8f) Some CustomException classes have introduced UNKNOWN error codes as a default fallback error code. We use CustomException codes to group issues together, but we don't want to do it with UNKNOWN error as they may not have anything in common. For exemple [this sentry for UNKNOWN code](https://twenty-v7.sentry.io/issues/6605750776/events/a72272d8941b4fa2add9b1f39c196d3f/?environment=prod&environment=prod-eu&project=4507072499810304&query=Unknown&referrer=next-event&stream_index=0) groups together "Unknown error importing calendar events for calendar channel...", "Insufficent permissions...", to name a few. **5. Improve postgres error grouping** commit [group together postgres errors](567c25495e) Postgres error are thrown by typeORM as QueryFailedError. we have a lot of them on sentry where they are badly grouped They are currently grouped on sentry according to the stack trace, which leads them to sometimes be grouped even if they don't have anything in common : for exemple [this sentry for QueryFailedError](https://twenty-v7.sentry.io/issues/6563624590/events/2d636821e27a448595b647b4b5a7d6a8/?environment=prod&environment=prod-eu&project=4507072499810304&query=is%3Aunresolved%20%21issue.type%3A%5Bperformance_consecutive_db_queries%2Cperformance_consecutive_http%2Cperformance_file_io_main_thread%2Cperformance_db_main_thread%2Cperformance_n_plus_one_db_queries%2Cperformance_n_plus_one_api_calls%2Cperformance_p95_endpoint_regression%2Cperformance_slow_db_query%2Cperformance_render_blocking_asset_span%2Cperformance_uncompressed_assets%2Cperformance_http_overhead%2Cperformance_large_http_payload%5D%20timesSeen%3A%3E10&referrer=previous-event&sort=date&stream_index=0) groups together "user mapping not found for "postgres" and "invalide type for uuid: 'fallback-id'" to name a few. I attempted to improve the grouping by grouping them with a new custom fingerPrint composed of the [code returned by Postgres](https://www.postgresql.org/docs/current/errcodes-appendix.html) + the truncated operation name (Find, Aggregate, Check...). This is still not ideal as postgres code are quite broad - we could have the same error code for two Find operations with different causes. let's give this a try !
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const query = gql`
|
||||
mutation DeleteOnePerson($idToDelete: ID!) {
|
||||
mutation DeleteOnePerson($idToDelete: UUID!) {
|
||||
deletePerson(id: $idToDelete) {
|
||||
__typename
|
||||
deletedAt
|
||||
|
||||
@ -5,7 +5,7 @@ import { getPeopleRecordConnectionMock } from '~/testing/mock-data/people';
|
||||
const peopleMock = getPeopleRecordConnectionMock();
|
||||
|
||||
export const query = gql`
|
||||
query FindDuplicatePerson($ids: [ID!]!) {
|
||||
query FindDuplicatePerson($ids: [UUID!]!) {
|
||||
personDuplicates(ids: $ids) {
|
||||
edges {
|
||||
node {
|
||||
|
||||
@ -4,7 +4,7 @@ import { PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS } from '@/object-record/hooks/
|
||||
import { responseData as person } from './useUpdateOneRecord';
|
||||
|
||||
export const query = gql`
|
||||
query FindOnePerson($objectRecordId: ID!) {
|
||||
query FindOnePerson($objectRecordId: UUID!) {
|
||||
person(filter: { id: { eq: $objectRecordId } }) {
|
||||
${PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@ import { PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS } from '@/object-record/hooks/
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const query = gql`
|
||||
mutation UpdateOnePerson($idToUpdate: ID!, $input: PersonUpdateInput!) {
|
||||
mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
|
||||
updatePerson(id: $idToUpdate, data: $input) {
|
||||
${PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { useDeleteOneRecordMutation } from '@/object-record/hooks/useDeleteOneRe
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const expectedQueryTemplate = `
|
||||
mutation DeleteOnePerson($idToDelete: ID!) {
|
||||
mutation DeleteOnePerson($idToDelete: UUID!) {
|
||||
deletePerson(id: $idToDelete) {
|
||||
__typename
|
||||
deletedAt
|
||||
|
||||
@ -6,7 +6,7 @@ import { useFindDuplicateRecordsQuery } from '@/object-record/hooks/useFindDupli
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const expectedQueryTemplate = `
|
||||
query FindDuplicatePerson($ids: [ID!]!) {
|
||||
query FindDuplicatePerson($ids: [UUID!]!) {
|
||||
personDuplicates(ids: $ids) {
|
||||
edges {
|
||||
node {
|
||||
|
||||
@ -6,7 +6,7 @@ import { useFindOneRecordQuery } from '@/object-record/hooks/useFindOneRecordQue
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const expectedQueryTemplate = `
|
||||
query FindOnePerson($objectRecordId: ID!) {
|
||||
query FindOnePerson($objectRecordId: UUID!) {
|
||||
person(filter: { id: { eq: $objectRecordId } }) {
|
||||
${PERSON_FRAGMENT_WITH_DEPTH_ZERO_RELATIONS}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMeta
|
||||
import { normalizeGQLQuery } from '~/utils/normalizeGQLQuery';
|
||||
|
||||
const expectedQueryTemplate = `
|
||||
mutation UpdateOnePerson($idToUpdate: ID!, $input: PersonUpdateInput!) {
|
||||
mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
|
||||
updatePerson(id: $idToUpdate, data: $input) {
|
||||
${PERSON_FRAGMENT_WITH_DEPTH_ZERO_RELATIONS}
|
||||
}
|
||||
|
||||
@ -4,8 +4,8 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
|
||||
import { mapSoftDeleteFieldsToGraphQLQuery } from '@/object-metadata/utils/mapSoftDeleteFieldsToGraphQLQuery';
|
||||
import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation';
|
||||
import { getDeleteOneRecordMutationResponseField } from '@/object-record/utils/getDeleteOneRecordMutationResponseField';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const useDeleteOneRecordMutation = ({
|
||||
objectNameSingular,
|
||||
@ -27,7 +27,7 @@ export const useDeleteOneRecordMutation = ({
|
||||
);
|
||||
|
||||
const deleteOneRecordMutation = gql`
|
||||
mutation DeleteOne${capitalizedObjectName}($idToDelete: ID!) {
|
||||
mutation DeleteOne${capitalizedObjectName}($idToDelete: UUID!) {
|
||||
${mutationResponseField}(id: $idToDelete)
|
||||
${mapSoftDeleteFieldsToGraphQLQuery(objectMetadataItem)}
|
||||
}
|
||||
|
||||
@ -3,8 +3,8 @@ import gql from 'graphql-tag';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation';
|
||||
import { getDestroyOneRecordMutationResponseField } from '@/object-record/utils/getDestroyOneRecordMutationResponseField';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const useDestroyOneRecordMutation = ({
|
||||
objectNameSingular,
|
||||
@ -26,7 +26,7 @@ export const useDestroyOneRecordMutation = ({
|
||||
);
|
||||
|
||||
const destroyOneRecordMutation = gql`
|
||||
mutation DestroyOne${capitalizedObjectName}($idToDestroy: ID!) {
|
||||
mutation DestroyOne${capitalizedObjectName}($idToDestroy: UUID!) {
|
||||
${mutationResponseField}(id: $idToDestroy) {
|
||||
id
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ export const useFindDuplicateRecordsQuery = ({
|
||||
const findDuplicateRecordsQuery = gql`
|
||||
query FindDuplicate${capitalize(
|
||||
objectMetadataItem.nameSingular,
|
||||
)}($ids: [ID!]!) {
|
||||
)}($ids: [UUID!]!) {
|
||||
${getFindDuplicateRecordsQueryResponseField(
|
||||
objectMetadataItem.nameSingular,
|
||||
)}(ids: $ids) {
|
||||
|
||||
@ -25,7 +25,7 @@ export const useFindOneRecordQuery = ({
|
||||
const findOneRecordQuery = gql`
|
||||
query FindOne${capitalize(
|
||||
objectMetadataItem.nameSingular,
|
||||
)}($objectRecordId: ID!) {
|
||||
)}($objectRecordId: UUID!) {
|
||||
${objectMetadataItem.nameSingular}(filter: {
|
||||
${
|
||||
withSoftDeleted
|
||||
|
||||
@ -8,8 +8,8 @@ import { EMPTY_MUTATION } from '@/object-record/constants/EmptyMutation';
|
||||
import { RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
|
||||
import { generateDepthOneRecordGqlFields } from '@/object-record/graphql/utils/generateDepthOneRecordGqlFields';
|
||||
import { getUpdateOneRecordMutationResponseField } from '@/object-record/utils/getUpdateOneRecordMutationResponseField';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const useUpdateOneRecordMutation = ({
|
||||
objectNameSingular,
|
||||
@ -43,7 +43,7 @@ export const useUpdateOneRecordMutation = ({
|
||||
);
|
||||
|
||||
const updateOneRecordMutation = gql`
|
||||
mutation UpdateOne${capitalizedObjectName}($idToUpdate: ID!, $input: ${capitalizedObjectName}UpdateInput!) {
|
||||
mutation UpdateOne${capitalizedObjectName}($idToUpdate: UUID!, $input: ${capitalizedObjectName}UpdateInput!) {
|
||||
${mutationResponseField}(id: $idToUpdate, data: $input) ${mapObjectMetadataToGraphQLQuery(
|
||||
{
|
||||
objectMetadataItems,
|
||||
|
||||
@ -23,7 +23,7 @@ import { recordStoreFamilySelector } from '@/object-record/record-store/states/s
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const query = gql`
|
||||
mutation UpdateOnePerson($idToUpdate: ID!, $input: PersonUpdateInput!) {
|
||||
mutation UpdateOnePerson($idToUpdate: UUID!, $input: PersonUpdateInput!) {
|
||||
updatePerson(id: $idToUpdate, data: $input) {
|
||||
${PERSON_FRAGMENT_WITH_DEPTH_ONE_RELATIONS}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ const mocks: MockedResponse[] = [
|
||||
request: {
|
||||
query: gql`
|
||||
mutation UpdateOneCompany(
|
||||
$idToUpdate: ID!
|
||||
$idToUpdate: UUID!
|
||||
$input: CompanyUpdateInput!
|
||||
) {
|
||||
updateCompany(id: $idToUpdate, data: $input) {
|
||||
|
||||
Reference in New Issue
Block a user