perf: Sentry perf tracing (#17202)
* chore: Add Sentry perf tracing * Just to build * perf: Add Sentry perf tracing * Removed the extra integrations tracing config * Got spans working * Now only tracing individual endpoints * Removed check for booking event type * Fixed types * Added back for spans * Consolidate sentry imports * Added more traces * Moved the start of the span
This commit is contained in:
1 parent
5a9197f357
commit
4b6b9badf5
12 files changed
+311
-274
No files matched your search
@@ -2,8 +2,8 @@ import { startSpan, captureException } from "@sentry/nextjs";
|
||||
|
||||
/*
|
||||
WHEN TO USE
|
||||
We ran a script that performs a simple mathematical calculation within a loop of 1000000 iterations.
|
||||
Our results were: Plain execution time: 441, Monitored execution time: 8094.
|
||||
We ran a script that performs a simple mathematical calculation within a loop of 1000000 iterations.
|
||||
Our results were: Plain execution time: 441, Monitored execution time: 8094.
|
||||
This suggests that using these wrappers within large loops can incur significant overhead and is thus not recommended.
|
||||
|
||||
For smaller loops, the cost incurred may not be very significant on an absolute scale
|
||||
@@ -15,7 +15,9 @@ const monitorCallbackAsync = async <T extends (...args: any[]) => any>(
|
||||
...args: Parameters<T>
|
||||
): Promise<ReturnType<T>> => {
|
||||
// Check if Sentry set
|
||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) return (await cb(...args)) as ReturnType<T>;
|
||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN || !process.env.SENTRY_TRACES_SAMPLE_RATE) {
|
||||
return (await cb(...args)) as ReturnType<T>;
|
||||
}
|
||||
|
||||
return await startSpan({ name: cb.name }, async () => {
|
||||
try {
|
||||
@@ -33,7 +35,8 @@ const monitorCallbackSync = <T extends (...args: any[]) => any>(
|
||||
...args: Parameters<T>
|
||||
): ReturnType<T> => {
|
||||
// Check if Sentry set
|
||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) return cb(...args) as ReturnType<T>;
|
||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN || !process.env.SENTRY_TRACES_SAMPLE_RATE)
|
||||
return cb(...args) as ReturnType<T>;
|
||||
|
||||
return startSpan({ name: cb.name }, () => {
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user