Merged in chore/redirect-counter (pull request #3302)

Counter name is now searchable and add counter for redirects

* refactor: createCounter() only takes one argument, the name of the counter. Makes it easier to search for

* feat: add counter when we do a redirect from redirect-service


Approved-by: Linus Flood
This commit is contained in:
Joakim Jäderberg
2025-12-08 10:24:05 +00:00
parent edca33c49f
commit 8b94540d19
61 changed files with 146 additions and 236 deletions

View File

@@ -157,8 +157,7 @@ export const userMutationRouter = router({
ctx,
}) {
const generatePreferencesLinkCounter = createCounter(
"trpc.user",
"generatePreferencesLink"
"trpc.user.generatePreferencesLink"
)
const metricsGeneratePreferencesLink = generatePreferencesLinkCounter.init()
@@ -196,7 +195,7 @@ export const userMutationRouter = router({
ctx,
input,
}) {
const signupCounter = createCounter("trpc.user", "signup")
const signupCounter = createCounter("trpc.user.signup")
const metricsSignup = signupCounter.init()
const apiResponse = await api.post(api.endpoints.v2.Profile.profile, {
@@ -224,8 +223,7 @@ export const userMutationRouter = router({
.input(profilingConsentInput)
.mutation(async function ({ ctx, input }) {
const profilingConsentCounter = createCounter(
"trpc.user",
"profilingConsent"
"trpc.user.profilingConsent"
)
const metricsProfilingConsent = profilingConsentCounter.init()
@@ -252,8 +250,7 @@ export const userMutationRouter = router({
.input(profilingConsentPromptDateInput)
.mutation(async function ({ ctx, input }) {
const profilingConsentPromptDateCounter = createCounter(
"trpc.user",
"profilingConsentPromptDate"
"trpc.user.profilingConsentPromptDate"
)
const metricsProfilingConsentPromptDate =
profilingConsentPromptDateCounter.init()

View File

@@ -234,8 +234,7 @@ export const userQueryRouter = router({
const { limit, page, lang } = input
const friendTransactionsCounter = createCounter(
"trpc.user.transactions",
"friendTransactions"
"trpc.user.transactions.friendTransactions"
)
const metricsFriendTransactions = friendTransactionsCounter.init({

View File

@@ -26,7 +26,7 @@ export const userTrackingInfo = safeProtectedProcedure.query(async function ({
})
async function getScandicFriendsUserTrackingData(session: Session | null) {
const userTrackingInfoCounter = createCounter("user", "userTrackingInfo")
const userTrackingInfoCounter = createCounter("user.userTrackingInfo")
const metricsUserTrackingInfo = userTrackingInfoCounter.init()
metricsUserTrackingInfo.start()

View File

@@ -15,7 +15,7 @@ export const getCreditCards = cache(
session: Session
onlyNonExpired?: boolean
}) => {
const getCreditCardsCounter = createCounter("user", "getCreditCards")
const getCreditCardsCounter = createCounter("user.getCreditCards")
const metricsGetCreditCards = getCreditCardsCounter.init({
onlyNonExpired,
})

View File

@@ -12,7 +12,7 @@ export async function getPreviousStays(
language: Lang,
cursor?: string
) {
const getPreviousStaysCounter = createCounter("user", "getPreviousStays")
const getPreviousStaysCounter = createCounter("user.getPreviousStays")
const metricsGetPreviousStays = getPreviousStaysCounter.init({
limit,
cursor,

View File

@@ -12,7 +12,7 @@ export async function getUpcomingStays(
language: Lang,
cursor?: string
) {
const getUpcomingStaysCounter = createCounter("user", "getUpcomingStays")
const getUpcomingStaysCounter = createCounter("user.getUpcomingStays")
const metricsGetUpcomingStays = getUpcomingStaysCounter.init({
limit,
cursor,

View File

@@ -22,7 +22,7 @@ export async function getPreviousStays(
language: Lang,
cursor?: string
) {
const getPreviousStaysCounter = createCounter("user", "getPreviousStays")
const getPreviousStaysCounter = createCounter("user.getPreviousStays")
const metricsGetPreviousStays = getPreviousStaysCounter.init({
limit,
cursor,
@@ -74,7 +74,7 @@ export async function getUpcomingStays(
language: Lang,
cursor?: string
) {
const getUpcomingStaysCounter = createCounter("user", "getUpcomingStays")
const getUpcomingStaysCounter = createCounter("user.getUpcomingStays")
const metricsGetUpcomingStays = getUpcomingStaysCounter.init({
limit,
cursor,
@@ -128,7 +128,7 @@ export const getCreditCards = cache(
session: Session
onlyNonExpired?: boolean
}) => {
const getCreditCardsCounter = createCounter("user", "getCreditCards")
const getCreditCardsCounter = createCounter("user.getCreditCards")
const metricsGetCreditCards = getCreditCardsCounter.init({
onlyNonExpired,
})

View File

@@ -11,7 +11,7 @@ export const getBasicUser = cache(
}: {
token: { expires_at?: number; access_token: string }
}) => {
const getBasicUserCounter = createCounter("user", "getBasicUser")
const getBasicUserCounter = createCounter("user.getBasicUser")
const metricsGetBasicUser = getBasicUserCounter.init()
metricsGetBasicUser.start()

View File

@@ -17,7 +17,7 @@ export const getVerifiedUser = cache(
token: { expires_at?: number; access_token: string }
includeExtendedPartnerData?: boolean
}) => {
const getVerifiedUserCounter = createCounter("user", "getVerifiedUser")
const getVerifiedUserCounter = createCounter("user.getVerifiedUser")
const metricsGetVerifiedUser = getVerifiedUserCounter.init()
metricsGetVerifiedUser.start()