From 5c1a9b512a838edd178eedfd7dccfc9a142c1011 Mon Sep 17 00:00:00 2001 From: Satish Gandham Date: Tue, 15 Jun 2021 20:53:48 +0530 Subject: [PATCH] Add an option to set tags on transactions #5147 --- app/client/src/utils/PerformanceTracker.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/client/src/utils/PerformanceTracker.ts b/app/client/src/utils/PerformanceTracker.ts index 68addb9343..934a4bfed1 100644 --- a/app/client/src/utils/PerformanceTracker.ts +++ b/app/client/src/utils/PerformanceTracker.ts @@ -33,8 +33,13 @@ export enum PerformanceTransactionName { LOGIN_CLICK = "LOGIN_CLICK", INIT_EDIT_APP = "INIT_EDIT_APP", INIT_VIEW_APP = "INIT_VIEW_APP", + SHOW_RESIZE_HANDLES = "SHOW_RESIZE_HANDLES", } +export type PerfTag = { + name: "string"; + value: "string"; +}; export interface PerfLog { sentrySpan: Span; skipLog?: boolean; @@ -51,6 +56,7 @@ class PerformanceTracker { eventName: PerformanceTransactionName, data?: any, skipLog = false, + tags: null | Array = null, ) => { if (appsmithConfigs.sentry.enabled) { const currentTransaction = Sentry.getCurrentHub() @@ -78,6 +84,11 @@ class PerformanceTracker { ); } const newTransaction = Sentry.startTransaction({ name: eventName }); + if (tags && Array.isArray(tags)) { + tags.forEach(({ name: tagName, value }) => { + newTransaction.setTag(tagName, value); + }); + } newTransaction.setData("startData", data); Sentry.getCurrentHub().configureScope((scope) => scope.setSpan(newTransaction),