Skip to content
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

fix(gettingstarted): clean up new profiling snippets #81231

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shellmayr
Copy link
Member

@shellmayr shellmayr commented Nov 25, 2024

  • Move the startProfiler/stopProfiler snippets for profiling out of the Setup SDK section & delete the corresponding tests & explicitly add the profilingOnboarding for Python for rendering the verification step in the sidebar
  • Modularize the snippets for node.js & python to make them more easily composable
  • Add a function calling setTimeout to demonstrate profiling in node.js

Before:
simon-test-us sentry io_projects_node-37_getting-started__product=performance-monitoring product=profiling

After:
simon-test-us dev getsentry net_7999_projects_node-37_getting-started__product=performance-monitoring product=profiling (2)

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 25, 2024
@shellmayr shellmayr changed the title fix(gettingstarted): move time import to top level in profiling snippet fix(gettingstarted): clean up new profiling snippet Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
static/app/gettingStartedDocs/python/python.tsx 62.50% 3 Missing ⚠️
...omponents/profiling/profilingOnboardingSidebar.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #81231   +/-   ##
=======================================
  Coverage   80.34%   80.34%           
=======================================
  Files        7219     7220    +1     
  Lines      319536   319591   +55     
  Branches    20779    20787    +8     
=======================================
+ Hits       256735   256783   +48     
- Misses      62407    62414    +7     
  Partials      394      394           

@shellmayr shellmayr changed the title fix(gettingstarted): clean up new profiling snippet fix(gettingstarted): clean up new profiling snippets Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Bundle Report

Changes will increase total bundle size by 18.28kB (0.06%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
app-webpack-bundle-array-push 32.01MB 18.28kB (0.06%) ⬆️

@shellmayr shellmayr marked this pull request as ready for review November 26, 2024 15:34
@shellmayr shellmayr requested review from a team as code owners November 26, 2024 15:34
const steps = [
...doc.install(docParams),
...doc.configure(docParams),
...doc.verify(docParams),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause all platforms to have verify step in the profiling sidebar.
This might be confusing, because most platforms only have verify instructions for error monitoring:
CleanShot 2024-11-27 at 12 53 58

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good point, I was under the impression that the existence of the profilingOnboarding attribute in the Docs object indicates that it will always be used and separately created, but we fallback to the normal docs in case there is no separate profiling onboarding.

Sentry.profiler.stopProfiler();
}
// Start a span
await Sentry.startSpan({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this complain that await is only valid in async functions? Or is the validate more for illustration purposes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snippet definitely works - the createServer is setup in async, so if this is pasted into the server snippet, everything falls into place. Is there a nicer way to do the setTimeout that doesn't need us to do this async?

sentry_sdk.profiler.stop_profiler()`
: ''
}`;
sentry_sdk.profiler.stop_profiler()`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to import sentry_sdk first?

@@ -138,7 +138,10 @@ const onboarding: OnboardingConfig = {
description: t(
'Raise an unhandled Python exception by inserting a divide by zero expression into your application:'
),
code: 'division_by_zero = 1 / 0',
code: `${hasContinuousProfiling(params) ? `# Verify profiling functionality ${getProfilingVerifySnippet()}` : ''}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we first verify errors and then after it profiling?

configurations: [
{
language: 'python',
code: getProfilingVerifySnippet(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we lost the note about continuous profiling, is that on purpose?
CleanShot 2024-11-27 at 13 10 11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc. @Zylphrex

@getsantry
Copy link
Contributor

getsantry bot commented Dec 19, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants