feat(sqllab): log error_detail on fetch failed (#23377)

This commit is contained in:
JUST.in DO IT
2023-03-20 10:08:27 -07:00
committed by GitHub
parent b0d83e8c50
commit 3277ea83ea
3 changed files with 48 additions and 6 deletions

View File

@@ -32,6 +32,8 @@ import {
} from 'src/components/MessageToasts/actions';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
import COMMON_ERR_MESSAGES from 'src/utils/errorMessages';
import { LOG_ACTIONS_SQLLAB_FETCH_FAILED_QUERY } from 'src/logger/LogUtils';
import { logEvent } from 'src/logger/actions';
import { newQueryTabName } from '../utils/newQueryTabName';
export const RESET_STATE = 'RESET_STATE';
@@ -269,6 +271,26 @@ export function queryFailed(query, msg, link, errors) {
})
: Promise.resolve();
const eventData = {
has_err: true,
start_offset: query.startDttm,
ts: new Date().getTime(),
};
errors?.forEach(({ error_type: errorType, extra }) => {
const messages = extra?.issue_codes.map(({ message }) => message) || [
errorType,
];
messages.forEach(message => {
dispatch(
logEvent(LOG_ACTIONS_SQLLAB_FETCH_FAILED_QUERY, {
...eventData,
error_type: errorType,
error_details: message,
}),
);
});
});
return (
sync
.catch(() =>