Added more Sentry message filtering, improved PDF metadata analysis

This commit is contained in:
Ryan Slobojan 2021-10-06 18:00:56 -04:00
parent 5fc81b82a8
commit d0eafe76c8
3 changed files with 7 additions and 5 deletions

View File

@ -36,7 +36,7 @@ function Page(props: PageProps): JSX.Element {
<a href="https://github.com/billylo1/covidpass" className="underline">{t('common:gitHub')}</a>
<a href="https://vaccine-ontario.ca" className="underline">{t('common:returnToMainSite')}</a>
</nav>
<div className="flex pt-4 flex-row space-x-4 justify-center text-md flex-wrap">Last updated: 2021-10-06 (v1.9.19)</div>
<div className="flex pt-4 flex-row space-x-4 justify-center text-md flex-wrap">Last updated: 2021-10-06 (v1.9.20)</div>
</footer>
</main>
</div>

View File

@ -58,12 +58,13 @@ async function detectReceiptType(fileBuffer : ArrayBuffer): Promise<string> {
const pdfDocument = await loadingTask.promise;
const pdfPage = await pdfDocument.getPage(1); //first page
const content = await pdfPage.getTextContent();
const docMetadata = await pdfDocument.getMetadata();
const numItems = content.items.length;
if (numItems == 0) { // QC has no text items
console.log('detected QC');
Sentry.setContext("QC-pdf-metadata", {
numPages: pdfDocument.numPages,
docMetadata: await pdfDocument.getMetadata()
docMetadata: JSON.stringify(docMetadata)
});
Sentry.captureMessage('QC PDF Metadata for structure analysis');
console.log(`PDF details: numPages=${pdfDocument.numPages}`);
@ -79,7 +80,7 @@ async function detectReceiptType(fileBuffer : ArrayBuffer): Promise<string> {
Sentry.setContext("BC-pdf-metadata", {
numPages: pdfDocument.numPages,
docMetadata: await pdfDocument.getMetadata()
docMetadata: JSON.stringify(docMetadata)
});
Sentry.captureMessage('BC PDF Metadata for structure analysis');
@ -88,7 +89,7 @@ async function detectReceiptType(fileBuffer : ArrayBuffer): Promise<string> {
// possible missed QC PDF?
Sentry.setContext("Possible-missed-QC-pdf-metadata", {
numPages: pdfDocument.numPages,
docMetadata: await pdfDocument.getMetadata(),
docMetadata: JSON.stringify(docMetadata),
matchedValue: value
});
Sentry.captureMessage('Possible missed QC PDF Metadata for structure analysis');

View File

@ -3,7 +3,7 @@ import { Integrations } from '@sentry/tracing';
export const initSentry = () => {
SentryModule.init({
release: 'grassroots_covidpass@1.9.19', // App version. Needs to be manually updated as we go unless we make the build smarter
release: 'grassroots_covidpass@1.9.20', // App version. Needs to be manually updated as we go unless we make the build smarter
dsn: 'https://7120dcf8548c4c5cb148cdde2ed6a778@o1015766.ingest.sentry.io/5981424',
integrations: [
new Integrations.BrowserTracing(),
@ -11,6 +11,7 @@ export const initSentry = () => {
ignoreErrors: [
'cancelled',
'annulé',
'已取消',
'invalidFileType',
'request timed out',
'blocked by content blocker',