Fix sentry log size error (#287)

* reduce sentry log size error by partially logging page created in elastic

* remove some debugging logs

* remove more debugging logs
This commit is contained in:
Hongbo Wu 2022-03-22 11:45:58 +08:00 committed by GitHub
parent db22c0d6be
commit c15efe6aad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 13 deletions

View file

@ -352,7 +352,7 @@ export const getPageByParam = async <K extends keyof ParamSet>(
id: body.hits.hits[0]._id,
} as Page
} catch (e) {
console.log('failed to search pages in elastic', e)
console.error('failed to search pages in elastic', e)
return undefined
}
}

View file

@ -349,7 +349,13 @@ export const createArticleResolver = authorized<
articleSavingRequest
)
}
log.info('page created in elastic', articleToSave)
log.info(
'page created in elastic',
pageId,
articleToSave.url,
articleToSave.slug,
articleToSave.title
)
articleToSave.id = pageId
}
@ -408,12 +414,7 @@ export const getArticleResolver: ResolverFn<
})
await createIntercomEvent('get-article', claims.uid)
console.log('start to get article', Date.now())
const page = await getPageByParam({ userId: claims.uid, slug })
console.log('get article from elastic', Date.now())
if (!page) {
return { errorCodes: [ArticleErrorCode.NotFound] }
}
@ -440,8 +441,6 @@ export const getArticlesResolver = authorized<
const startCursor = params.after || ''
const first = params.first || 10
console.log('getArticlesResolver starts', Date.now())
// Perform basic sanitization. Right now we just allow alphanumeric, space and quote
// so queries can contain phrases like "human race";
// We can also split out terms like "label:unread".
@ -461,8 +460,6 @@ export const getArticlesResolver = authorized<
},
})
console.log('parsed search query', Date.now())
await createIntercomEvent('search', claims.uid)
const [pages, totalCount] = (await searchPages(
@ -485,8 +482,6 @@ export const getArticlesResolver = authorized<
const hasNextPage = pages.length > first
const endCursor = String(start + pages.length - (hasNextPage ? 1 : 0))
console.log('get search result', Date.now())
console.log(
'start',
start,