mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 22:34:01 -05:00
f
This commit is contained in:
parent
a60756b321
commit
35edb30e18
2 changed files with 6 additions and 5 deletions
|
@ -59,10 +59,10 @@ module.exports = class LinkClickRepository {
|
|||
async save(linkClick) {
|
||||
let member;
|
||||
|
||||
sentry.startSpan({name: 'Member.findOne'}, async () => {
|
||||
const usingCache = config && config.get('linkClickTrackingCacheMemberUuid');
|
||||
await sentry.startSpan({name: `Member.findOne > ${usingCache ? 'cache' : 'db'}`}, async () => {
|
||||
try {
|
||||
console.log(`finding member`);
|
||||
if (config && config.get('linkClickTrackingCacheMemberUuid')) {
|
||||
if (usingCache) {
|
||||
member = await this.memoizedFindOne(linkClick.member_uuid);
|
||||
} else {
|
||||
member = await this.#Member.findOne({uuid: linkClick.member_uuid});
|
||||
|
|
|
@ -76,7 +76,8 @@ const ALLOWED_HTTP_TRANSACTIONS = [
|
|||
'/members/api', // any Members API call
|
||||
'/:slug', // any frontend post/page
|
||||
'/author', // any frontend author page
|
||||
'/tag' // any frontend tag page
|
||||
'/tag', // any frontend tag page
|
||||
'/r' // redirect
|
||||
].map((path) => {
|
||||
// Sentry names HTTP transactions like: "<HTTP_METHOD> <PATH>" i.e. "GET /ghost/api/content/settings"
|
||||
// Match any of the paths above with any HTTP method, and also the homepage "GET /"
|
||||
|
@ -88,10 +89,10 @@ const ALLOWED_HTTP_TRANSACTIONS = [
|
|||
* @returns {import('@sentry/node').Event | null}
|
||||
*/
|
||||
const beforeSendTransaction = function (event) {
|
||||
console.log(`event.transaction`, event.transaction);
|
||||
// Drop transactions that are not in the allowed list
|
||||
for (const transaction of ALLOWED_HTTP_TRANSACTIONS) {
|
||||
const match = event.transaction.match(transaction);
|
||||
|
||||
if (match?.groups?.path) {
|
||||
return event;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue