mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -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) {
|
async save(linkClick) {
|
||||||
let member;
|
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 {
|
try {
|
||||||
console.log(`finding member`);
|
if (usingCache) {
|
||||||
if (config && config.get('linkClickTrackingCacheMemberUuid')) {
|
|
||||||
member = await this.memoizedFindOne(linkClick.member_uuid);
|
member = await this.memoizedFindOne(linkClick.member_uuid);
|
||||||
} else {
|
} else {
|
||||||
member = await this.#Member.findOne({uuid: linkClick.member_uuid});
|
member = await this.#Member.findOne({uuid: linkClick.member_uuid});
|
||||||
|
|
|
@ -76,7 +76,8 @@ const ALLOWED_HTTP_TRANSACTIONS = [
|
||||||
'/members/api', // any Members API call
|
'/members/api', // any Members API call
|
||||||
'/:slug', // any frontend post/page
|
'/:slug', // any frontend post/page
|
||||||
'/author', // any frontend author page
|
'/author', // any frontend author page
|
||||||
'/tag' // any frontend tag page
|
'/tag', // any frontend tag page
|
||||||
|
'/r' // redirect
|
||||||
].map((path) => {
|
].map((path) => {
|
||||||
// Sentry names HTTP transactions like: "<HTTP_METHOD> <PATH>" i.e. "GET /ghost/api/content/settings"
|
// 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 /"
|
// 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}
|
* @returns {import('@sentry/node').Event | null}
|
||||||
*/
|
*/
|
||||||
const beforeSendTransaction = function (event) {
|
const beforeSendTransaction = function (event) {
|
||||||
|
console.log(`event.transaction`, event.transaction);
|
||||||
// Drop transactions that are not in the allowed list
|
// Drop transactions that are not in the allowed list
|
||||||
for (const transaction of ALLOWED_HTTP_TRANSACTIONS) {
|
for (const transaction of ALLOWED_HTTP_TRANSACTIONS) {
|
||||||
const match = event.transaction.match(transaction);
|
const match = event.transaction.match(transaction);
|
||||||
|
|
||||||
if (match?.groups?.path) {
|
if (match?.groups?.path) {
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue