-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kdesktop 1264 implement sentry transaction. #403
base: develop
Are you sure you want to change the base?
Conversation
…github.com/Infomaniak/desktop-kDrive into KDESKTOP-1264-Implement-Sentry-transaction
pTraceId startTransaction(const std::string &name, const std::string &description); | ||
pTraceId startSpan(const std::string &name, const std::string &description, const pTraceId &parentId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you briefly explain in comment what in a transaction
and what is a span
in Sentry context?
@@ -358,16 +367,46 @@ void SyncPalWorker::initStep(SyncStep step, std::shared_ptr<ISyncWorker> (&worke | |||
} | |||
} | |||
|
|||
SentryHandler::PTraceName SyncPalWorker::setpToPTraceName(SyncStep step) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this could be defined in SentryHandler
instead to avoid increasing the size of SyncPalWorker
class
if (perfMonitorCounter % 1000 == 0) { | ||
perfMonitor.stopAndStart(SentryHandler::PTraceName::LFSO_ExploreItem, syncDbId(), true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we delegate this logic to the SentryHandler::ScopedPTrace
class? The goal should always to add as less as possible into the caller method. LocalFileSystemObserverWorker
is already quite complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this: 0a60107
if (itemCount % 1000 == 0) { | ||
sentryTransaction.stopAndStart(SentryHandler::PTraceName::RFSO_ExploreItem, syncDbId(), true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Clément Kunz <[email protected]>
Quality Gate passedIssues Measures |
PerformanceTrace (PTrace) Integration for Enhanced Monitoring 🚀
The PerformanceTrace (PTrace) system is designed to track the execution time of various parts of our codebase and send performance data to Sentry for analysis. This enables monitoring, troubleshooting, and optimization the application.
How PerformanceTrace Works 📜
Manual PerformanceTrace (Not Recommended in Most Cases 🛑 )
In
sentryhandler.h
, the enumPTraceName
defines all the traceable steps, such as:PTraceName::Sync
PTraceName::UpdateDetection1
PTraceName::UpdateUnsyncedList
, and others.To minimize the impact in codebase readability due to performance monitoring, pTrace details are defined in the constructor of the
SentryHandler::PTraceInfo
structure.Although
SentryHandler::PTraceInfo
is used exclusively withinSentryHandler
, it must be updated whenever a new trace is added. This structure provides the following:PTraces
.Example implementation in the constructor:
This setup enables child
PTraces
to be started automatically as children of their respective parent traces without requiring explicit management of parent IDs by the caller (see below).Example of Manual PTrace Management:
Scoped PerformanceTrace (Recommended in Most Cases ✅ 🦺 )
The
SentryHandler::ScopedPTrace
class simplifies performance tracing by ensuring that traces are always stopped properly, avoiding:When a
SentryHandler::ScopedPTrace
object is destroyed, its associated trace is automatically stopped.Constructor Options:
PTraceName
and asyncDbId
.pTraceId
.Optional: A
manualStopExpected
flag (default:false
). If set totrue
, the trace must be stopped manually usingstop()
before the object is destroyed. Otherwise, the trace is marked as aborted, which is helpful for identifying problematic steps on the Sentry dashboard.Example Usage:
Additional Features:
SentryHandler::ScopedPTrace::stopAndStart
Method: Stops the current trace and starts a new one with the provided parameters (same asScopedPTrace
constructor).SentryHandler::ScopedPTrace::stop(true)
can be call with theaborted
set to true wich will force the pTrace to an aborted state.Tracing Outside Synchronization
A
PTrace
orScopedPTrace
can be started outside the synchronization context by passing-1
for thesyncDbId
argument.PTraceName
can only be started once persyncDbId
. (asserted in debug mode, ignored in release).Sentry Dashboard 📊
The Sentry dashboard automatically processes
PTraces
to provide meaningful insights:Trace Breakdown
Example: Breakdown of a specific sync operation.
Performance Statistics
For each
PTrace
, we get metrics like median time (P50), P75, and P90 durations, along with other insights:Benefits of PTrace
This system provides invaluable data for: