Bug 1748445 - remove unused attributes from text_log_errors API endpoint

This improves the response time for tasks with many failure lines locally by a
factor of 5. In production these requests often timed out because they were
too slow to get a response.
This commit is contained in:
Sebastian Hengst 2022-01-31 14:29:10 +01:00
Родитель faee77dcf3
Коммит d5e7843d60
3 изменённых файлов: 2 добавлений и 63 удалений

Просмотреть файл

@ -225,32 +225,12 @@ def test_text_log_errors(client, test_job):
'job': 1,
'line': 'failure 1',
'line_number': 101,
'bug_suggestions': {
'search': 'failure 1',
'path_end': None,
'search_terms': ['failure 1'],
'bugs': {'open_recent': [], 'all_others': []},
'line_number': 101,
},
'metadata': None,
'matches': [],
'classified_failures': [],
},
{
'id': 2,
'job': 1,
'line': 'failure 2',
'line_number': 102,
'bug_suggestions': {
'search': 'failure 2',
'path_end': None,
'search_terms': ['failure 2'],
'bugs': {'open_recent': [], 'all_others': []},
'line_number': 102,
},
'metadata': None,
'matches': [],
'classified_failures': [],
},
]

Просмотреть файл

@ -182,20 +182,7 @@ class FailureLineNoStackSerializer(serializers.ModelSerializer):
return response
class TextLogErrorMetadataSerializer(serializers.ModelSerializer):
failure_line = FailureLineNoStackSerializer(read_only=True)
class Meta:
model = models.TextLogErrorMetadata
fields = '__all__'
class TextLogErrorSerializer(serializers.ModelSerializer):
matches = TextLogErrorMatchSerializer(many=True)
classified_failures = ClassifiedFailureSerializer(many=True)
bug_suggestions = NoOpSerializer(read_only=True)
metadata = TextLogErrorMetadataSerializer(read_only=True)
class Meta:
model = models.TextLogError
exclude = ['step']

Просмотреть файл

@ -5,16 +5,9 @@ import { faSpinner } from '@fortawesome/free-solid-svg-icons';
import { thBugSuggestionLimit, thEvents } from '../../../helpers/constants';
import { getResultState, isReftest } from '../../../helpers/job';
import {
getBugUrl,
getLogViewerUrl,
getReftestUrl,
textLogErrorsEndpoint,
} from '../../../helpers/url';
import { getBugUrl, getReftestUrl } from '../../../helpers/url';
import BugFiler from '../../BugFiler';
import BugSuggestionsModel from '../../../models/bugSuggestions';
import { getData } from '../../../helpers/http';
import { getProjectJobUrl } from '../../../helpers/location';
import ErrorsList from './ErrorsList';
import ListItem from './ListItem';
@ -74,7 +67,7 @@ class FailureSummaryTab extends React.Component {
};
loadBugSuggestions = () => {
const { repoName, selectedJob } = this.props;
const { selectedJob } = this.props;
if (!selectedJob) {
return;
@ -96,27 +89,6 @@ class FailureSummaryTab extends React.Component {
!suggestion.bugs.too_many_open_recent;
});
// if we have no bug suggestions, populate with the raw errors from
// the log (we can do this asynchronously, it should normally be
// fast)
if (!suggestions.length) {
const { data, failureStatus } = await getData(
getProjectJobUrl(textLogErrorsEndpoint, selectedJob.id),
);
if (!failureStatus && data.length) {
const errors = data.map((error) => ({
line: error.line,
line_number: error.line_number,
logViewerUrl: getLogViewerUrl(
selectedJob.id,
repoName,
error.line_number,
),
}));
this.setState({ errors });
}
}
this.setState({ bugSuggestionsLoading: false, suggestions }, () => {
const scrollArea = document.querySelector(
'#failure-summary-scroll-area',