-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: options.AddProfilingIntegration() #3660
Conversation
|
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.
don't have the full picture anymore but could we add the integration automatically if the sample rates was set? I wonder if it could help with the iOS situation where this shouldn't be called
|
@vaind I think regardless of that we should add this in and change the docs. Much nicer API than the current approacbh |
actually I've pasted that comment in the wrong PR sorry for closing this |
To really answer your question: I don't know if/how we could do that. The integration is defined in another package so we can't directly reference it in the main Sentry package. I've thought about making the actual |
It would require reflection. |
/// and the profiler session hasn't started yet, the execution is unblocked and behaves as the async startup, | ||
/// i.e. transactions will be profiled only after the session is eventually started. | ||
/// </param> | ||
public static void AddProfilingIntegration(this SentryOptions options, TimeSpan startupTimeout = default) |
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.
We could though #if IOS
here and have a no-op version?
"on iOS we use a native profiler"
Then it wouldn't matter during Set Up if we say AddProfilerIntegration
on all platforms. It would just no-op on iOS?
#if IOS
// debug log?
return;
#endif
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.
how about 5abd66d
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.
Nice! that looks good
{ | ||
if (_profilingIntegrationAddedByUser) | ||
{ | ||
DiagnosticLogger?.LogWarning($"{nameof(ProfilingIntegration)} has already been added. The second call to {nameof(AddProfilingIntegration)} will be ignored."); |
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.
Wondering if a warning is needed. Because if I have a shared Init logic for Sentry by used Apps, I just want profiling to be there. the fact iOS has it automatically but not the other platforms is irrelevant.
DiagnosticLogger?.LogWarning($"{nameof(ProfilingIntegration)} has already been added. The second call to {nameof(AddProfilingIntegration)} will be ignored."); | |
DiagnosticLogger?.LogDebug($"{nameof(ProfilingIntegration)} on iOS is added automatically. The second call to {nameof(AddProfilingIntegration)} will be ignored."); |
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.
I've added the warning (actually the exact line of code) from the other profiling integration. Arguably, it may be unnecessary to warn when you add the same thing multiple times, no clue why integrations have warnings about that.
Because if I have a shared Init logic for Sentry by used Apps, I just want profiling to be there. the fact iOS has it automatically but not the other platforms is irrelevant.
Doesn't play a role here. The warning only triggers when a user added the integration manually multiple times. Not when they add it once after we've added it automatically during init.
I'll go ahead and merge this as is so it's exactly the same as the other profiling integration (which also warns only when you add it manually multiple times). We can change it later in all the places with he same LogWarning if you think we should
No description provided.