Add an option to set tags on transactions #5147
This commit is contained in:
parent
c00cce0b12
commit
5c1a9b512a
|
|
@ -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<PerfTag> = 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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user