Skip to content

Commit

Permalink
[Reporting] Download report: add debug logging around sending of 5xx …
Browse files Browse the repository at this point in the history
…codes (#183852)

## Summary

These logs help correlate errors one may see from investigating HTTP 5xx
status codes that are sent in response to the Download Report API.

Related to: #183846
  • Loading branch information
tsullivan authored May 20, 2024
1 parent 3a23efe commit 105baf4
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const getReportingHeaders = (output: TaskRunResult, exportType: ExportType) => {
};

export function getDocumentPayloadFactory(reporting: ReportingCore) {
const { logger: _logger } = reporting.getPluginSetupDeps();
const logger = _logger.get('download-report');
const exportTypesRegistry = reporting.getExportTypesRegistry();

async function getCompleted({
Expand Down Expand Up @@ -88,6 +90,8 @@ export function getDocumentPayloadFactory(reporting: ReportingCore) {
const jobsQuery = jobsQueryFactory(reporting);
const error = await jobsQuery.getError(id);

logger.debug(`Report job ${id} has failed. Sending statusCode: 500`);

return {
statusCode: 500,
content: {
Expand All @@ -98,7 +102,9 @@ export function getDocumentPayloadFactory(reporting: ReportingCore) {
};
}

function getIncomplete({ status }: ReportApiJSON): Payload {
function getIncomplete({ id, status }: ReportApiJSON): Payload {
logger.debug(`Report job ${id} is processing. Sending statusCode: 503`);

return {
statusCode: 503,
content: status,
Expand Down

0 comments on commit 105baf4

Please sign in to comment.