Skip to content

Commit

Permalink
Merge branch 'master' into priscila/ref/quick-start/tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
priscilawebdev authored Dec 2, 2024
2 parents c6dbb26 + 5ecbec6 commit fd8b878
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 281 deletions.
3 changes: 2 additions & 1 deletion src/sentry/lang/java/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _handles_frame(frame: dict[str, Any], platform: str) -> bool:
)


FRAME_FIELDS = ("abs_path", "lineno", "function", "module", "filename", "in_app")
FRAME_FIELDS = ("platform", "abs_path", "lineno", "function", "module", "filename", "in_app")


def _normalize_frame(raw_frame: dict[str, Any], index: int) -> dict[str, Any]:
Expand Down Expand Up @@ -287,6 +287,7 @@ def process_jvm_stacktraces(symbolicator: Symbolicator, data: Any) -> Any:
release_package = _get_release_package(symbolicator.project, data.get("release"))
metrics.incr("process.java.symbolicate.request")
response = symbolicator.process_jvm(
platform=data.get("platform"),
exceptions=[
{"module": exc["module"], "type": exc["type"]} for exc in processable_exceptions
],
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/lang/javascript/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _normalize_nonhandled_frame(frame, data):
return frame


FRAME_FIELDS = ("abs_path", "lineno", "colno", "function")
FRAME_FIELDS = ("platform", "abs_path", "lineno", "colno", "function")


def _normalize_frame(raw_frame: Any) -> dict:
Expand Down Expand Up @@ -240,6 +240,7 @@ def process_js_stacktraces(symbolicator: Symbolicator, data: Any) -> Any:

metrics.incr("process.javascript.symbolicate.request")
response = symbolicator.process_js(
platform=data.get("platform"),
stacktraces=stacktraces,
modules=modules,
release=data.get("release"),
Expand Down
8 changes: 5 additions & 3 deletions src/sentry/lang/native/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def process_minidump(symbolicator: Symbolicator, data: Any) -> Any:
return

metrics.incr("process.native.symbolicate.request")
response = symbolicator.process_minidump(minidump.data)
response = symbolicator.process_minidump(data.get("platform"), minidump.data)

if _handle_response_status(data, response):
_merge_full_response(data, response)
Expand All @@ -308,7 +308,7 @@ def process_applecrashreport(symbolicator: Symbolicator, data: Any) -> Any:
return

metrics.incr("process.native.symbolicate.request")
response = symbolicator.process_applecrashreport(report.data)
response = symbolicator.process_applecrashreport(data.get("platform"), report.data)

if _handle_response_status(data, response):
_merge_full_response(data, response)
Expand Down Expand Up @@ -423,7 +423,9 @@ def process_native_stacktraces(symbolicator: Symbolicator, data: Any) -> Any:
signal = signal_from_data(data)

metrics.incr("process.native.symbolicate.request")
response = symbolicator.process_payload(stacktraces=stacktraces, modules=modules, signal=signal)
response = symbolicator.process_payload(
platform=data.get("platform"), stacktraces=stacktraces, modules=modules, signal=signal
)

if not _handle_response_status(data, response):
return data
Expand Down
17 changes: 13 additions & 4 deletions src/sentry/lang/native/symbolicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ def _process(self, task_name: str, path: str, **kwargs):
# Otherwise, we are done processing, yay
return json_response

def process_minidump(self, minidump):
def process_minidump(self, platform, minidump):
(sources, process_response) = sources_for_symbolication(self.project)
scraping_config = get_scraping_config(self.project)
data = {
"platform": orjson.dumps(platform).decode(),
"sources": orjson.dumps(sources).decode(),
"scraping": orjson.dumps(scraping_config).decode(),
"options": '{"dif_candidates": true}',
Expand All @@ -173,10 +174,11 @@ def process_minidump(self, minidump):
)
return process_response(res)

def process_applecrashreport(self, report):
def process_applecrashreport(self, platform, report):
(sources, process_response) = sources_for_symbolication(self.project)
scraping_config = get_scraping_config(self.project)
data = {
"platform": orjson.dumps(platform).decode(),
"sources": orjson.dumps(sources).decode(),
"scraping": orjson.dumps(scraping_config).decode(),
"options": '{"dif_candidates": true}',
Expand All @@ -190,10 +192,13 @@ def process_applecrashreport(self, report):
)
return process_response(res)

def process_payload(self, stacktraces, modules, signal=None, apply_source_context=True):
def process_payload(
self, platform, stacktraces, modules, signal=None, apply_source_context=True
):
(sources, process_response) = sources_for_symbolication(self.project)
scraping_config = get_scraping_config(self.project)
json = {
"platform": platform,
"sources": sources,
"options": {
"dif_candidates": True,
Expand All @@ -210,11 +215,12 @@ def process_payload(self, stacktraces, modules, signal=None, apply_source_contex
res = self._process("symbolicate_stacktraces", "symbolicate", json=json)
return process_response(res)

def process_js(self, stacktraces, modules, release, dist, apply_source_context=True):
def process_js(self, platform, stacktraces, modules, release, dist, apply_source_context=True):
source = get_internal_artifact_lookup_source(self.project)
scraping_config = get_scraping_config(self.project)

json = {
"platform": platform,
"source": source,
"stacktraces": stacktraces,
"modules": modules,
Expand All @@ -231,6 +237,7 @@ def process_js(self, stacktraces, modules, release, dist, apply_source_context=T

def process_jvm(
self,
platform,
exceptions,
stacktraces,
modules,
Expand All @@ -242,6 +249,7 @@ def process_jvm(
Process a JVM event by remapping its frames and exceptions with
ProGuard.
:param platform: The event's platform. This should be either unset or "java".
:param exceptions: The event's exceptions. These must contain a `type` and a `module`.
:param stacktraces: The event's stacktraces. Frames must contain a `function` and a `module`.
:param modules: ProGuard modules and source bundles. They must contain a `uuid` and have a
Expand All @@ -253,6 +261,7 @@ def process_jvm(
source = get_internal_source(self.project)

json = {
"platform": platform,
"sources": [source],
"exceptions": exceptions,
"stacktraces": stacktraces,
Expand Down
4 changes: 3 additions & 1 deletion src/sentry/profiles/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def symbolicate(
) -> Any:
if platform in SHOULD_SYMBOLICATE_JS:
return symbolicator.process_js(
platform=platform,
stacktraces=stacktraces,
modules=modules,
release=profile.get("release"),
Expand All @@ -507,6 +508,7 @@ def symbolicate(
)
elif platform == "android":
return symbolicator.process_jvm(
platform=platform,
exceptions=[],
stacktraces=stacktraces,
modules=modules,
Expand All @@ -515,7 +517,7 @@ def symbolicate(
classes=[],
)
return symbolicator.process_payload(
stacktraces=stacktraces, modules=modules, apply_source_context=False
platform=platform, stacktraces=stacktraces, modules=modules, apply_source_context=False
)


Expand Down
4 changes: 0 additions & 4 deletions static/app/components/onboarding/productSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ export const platformProductAvailability = {
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.SESSION_REPLAY,
],
'javascript-nuxt': [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.SESSION_REPLAY,
],
'javascript-angular': [
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.SESSION_REPLAY,
Expand Down
68 changes: 13 additions & 55 deletions static/app/gettingStartedDocs/javascript/nuxt.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,33 @@ describe('javascript-nuxt onboarding docs', function () {
renderWithOnboardingLayout(docs);

// Renders main headings
expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument();
expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument();
expect(screen.getByRole('heading', {name: 'Upload Source Maps'})).toBeInTheDocument();
expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();

// Includes 2 import statements
expect(
screen.getAllByText(
textWithMarkupMatcher(/import \* as Sentry from "@sentry\/nuxt"/)
)
).toHaveLength(2);
});

it('displays sample rates by default', () => {
renderWithOnboardingLayout(docs, {
selectedProducts: [
ProductSolution.ERROR_MONITORING,
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.SESSION_REPLAY,
],
});

expect(screen.getAllByText(textWithMarkupMatcher(/tracesSampleRate/))).toHaveLength(
2
); // client and server
expect(
screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate/))
).toBeInTheDocument(); // only client
screen.getByRole('heading', {name: 'Automatic Configuration (Recommended)'})
).toBeInTheDocument();
// Renders main headings
expect(
screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate/))
).toBeInTheDocument(); // only client
});

it('enables performance setting the tracesSampleRate to 1', () => {
renderWithOnboardingLayout(docs, {
selectedProducts: [
ProductSolution.ERROR_MONITORING,
ProductSolution.PERFORMANCE_MONITORING,
],
});
screen.getByRole('heading', {name: 'Manual Configuration'})
).toBeInTheDocument();
// Renders main headings
expect(screen.getByRole('heading', {name: 'Verify'})).toBeInTheDocument();

// Includes configure statement
expect(
screen.getAllByText(textWithMarkupMatcher(/tracesSampleRate: 1\.0/))
).toHaveLength(2);
screen.getByText(textWithMarkupMatcher(/npx @sentry\/wizard@latest -i nuxt/))
).toBeInTheDocument();
});

it('enables replay by setting replay samplerates', () => {
it('displays the verify instructions', () => {
renderWithOnboardingLayout(docs, {
selectedProducts: [
ProductSolution.ERROR_MONITORING,
ProductSolution.PERFORMANCE_MONITORING,
ProductSolution.SESSION_REPLAY,
],
});

expect(
screen.getByText(textWithMarkupMatcher(/replaysSessionSampleRate: 0\.1/))
).toBeInTheDocument();
expect(
screen.getByText(textWithMarkupMatcher(/replaysOnErrorSampleRate: 1\.0/))
screen.queryByText(textWithMarkupMatcher(/sentry-example-page/))
).toBeInTheDocument();
});

it('enables profiling by setting profiling sample rates', () => {
renderWithOnboardingLayout(docs, {
selectedProducts: [ProductSolution.ERROR_MONITORING, ProductSolution.PROFILING],
});

expect(
screen.getAllByText(textWithMarkupMatcher(/profilesSampleRate: 1\.0/))
).toHaveLength(2);
});
});
Loading

0 comments on commit fd8b878

Please sign in to comment.