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

Excluding proxy classes from stack trace #1018

Closed
svetlana-nikitina opened this issue Oct 29, 2020 · 10 comments · Fixed by getsentry/sentry#45185 or getsentry/sentry#51040
Closed

Excluding proxy classes from stack trace #1018

svetlana-nikitina opened this issue Oct 29, 2020 · 10 comments · Fixed by getsentry/sentry#45185 or getsentry/sentry#51040

Comments

@svetlana-nikitina
Copy link

svetlana-nikitina commented Oct 29, 2020

Hi, we are running sentry java sdk on play framework ver. 2.6.5 with Java 1.8

<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry</artifactId>
    <version>3.1.1</version>
</dependency>

and experience an issue that the guice-enhanced proxies are apparently the parts of the stack trace fingerprint calculation, so we have a lot of detached events:

image

I see some old tickets which in the legacy SDK which used to solve the problem: #516
but don't see anything in the new sdk

Is it supported? How the issue be fixed?

@marandaneto
Copy link
Contributor

hey @svetlana-nikitina thanks for raising this.

does it help if you add those packages as inAppExclude via SentryOptions.addInAppExclude(package)? thanks!

@bruno-garcia
Copy link
Member

Dupe: getsentry/sentry#21645

@svetlana-nikitina
Copy link
Author

it don't think it's possible , because of:

  1. InAppInclude has the higher prio over InAppExclude
    so if i do:
    SentryOptions.addInAppInclude("my.app.package")
    this has higher prio over:
    SentryOptions. addInAppExclude("my.app.package.whatever.package.under.main")
    so adding addInAppExclude is just ignored
  2. even if it was not ignored, i cannot provide regexp here which i basically need:
    SentryOptions. addInAppExclude("EnhancedByGuice")

However after paying around with sentry UI seems like it've fixed it Custom Grouping Enhancements section by this rule:

stack.module:*EnhancerByGuice* -group
stack.module:*EnhancerByGuice* -app

However I should say that Java documentation is a disaster, as all examples and explanations are about JS, not Java: https://docs.sentry.io/platforms/java/data-management/event-grouping/grouping-enhancements/

@maciejwalkowiak
Copy link
Contributor

Thanks @svetlana-nikitina for feedback. We are working on making docs better. If you have something specific to add or change you are welcome to suggest changes in https://github.com/getsentry/sentry-docs/

@maciejwalkowiak
Copy link
Contributor

maciejwalkowiak commented Nov 23, 2020

We could bring the same blacklisting logic as in 1.x:

private static final Pattern IN_APP_BLACKLIST = Pattern.compile("\\$+" // match $ (one or more)
        + "(?:" // start outer group
        + "(?:EnhancerBy[a-zA-Z]*)"  // Match Enhancer classes
        + "|(?:FastClassBy[a-zA-Z]*)" // Match FastClass
        + "|(?:HibernateProxy)" // match Hibernate proxies
        + ")\\$+"); // end outer group and match $ (one or more)

What do you think @bruno-garcia?

@mitsuhiko
Copy link
Member

Generally at this point I think we should fix this on the server with improved default stack trace rules rather than in the SDKs themselves.

@bruno-garcia
Copy link
Member

bruno-garcia commented Nov 24, 2020

@adinauer
Copy link
Member

adinauer commented May 3, 2022

@mitsuhiko how should we proceed with this?

@buckett
Copy link
Contributor

buckett commented Jan 25, 2023

I think we are hitting the same issue whereby stack traces aren't getting matched up because of the hibernate proxies not matching, in our case the proxies are:

    at org.hibernate.proxy.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:95)
    at uk.ac.ox.ctl.usermanagement.model.User$HibernateProxy$oRWxjAWT.toString // This is what is causing the problems
    at uk.ac.ox.ctl.usermanagement.model.EnrolmentsSIS$SISWriter.write(EnrolmentsSIS.java:36)

There seems to have been discussion about this a few years ago but things have stalled, the suggestion by @svetlana-nikitina of using the custom grouping is now documented on https://docs.sentry.io/product/data-management-settings/event-grouping/stack-trace-rules/ and looks to still be possible. Having the ability to customise this is good, however having it work out of the box for common use cases is much better. Filtering out dynamic classes generated by common frameworks seems like a sensible default to enable for everyone.

@adinauer
Copy link
Member

We have a PR to improve fingerprinting of the stack traces mentioned here: getsentry/sentry#45185

Thanks for the feedback.

@adinauer adinauer assigned adinauer and unassigned bruno-garcia Feb 28, 2023
armenzg added a commit to getsentry/sentry that referenced this issue Jun 15, 2023
Customers that have auto-update disabled will not be updated.

The [2023-01-11](https://github.com/getsentry/sentry/blob/42a860c4fd13672cb3fa3384ede490654de44e0f/src/sentry/grouping/strategies/configurations.py#L189-L202) group config has the following changes:
* A Java grouping fix: [java_cglib_hibernate_logic](#45185)
* [A bunch of stacktrace enhancers](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt) (based on the mobile enhancers)
  * More info in section 2

From: #45185 behind the `java_cglib_hibernate_logic` branch:

Do not consider these as inApp:
- `$EnhancerBy...$`
- `$FastClassBy...$`
- `$HibernateProxy$`

Fixes getsentry/sentry-java#1018

[The file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt) has a bunch of enhancers. You can review the `pynsap` changes in the PR to get a sense of the changes.

This is based off [the mobile enhancers file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/[email protected]). It basically adds the following [extra rules](https://github.com/getsentry/sentry/blob/8ef3e68d626d06859960a630a46296d52a9b93dc/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt#L404-L463).

All the PRs listed below are also part of [this milestone](https://github.com/getsentry/sentry/milestone/50?closed=1).

The enhancements on top of the mobile enhancers includes these PRs (from [this historical view](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)):
* #45423
* #44761

The changes for the mobile enhancers can be seen [here](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/mobile%402021-04-02.txt):
* #28669
* #28069
* #27994
* #27880
* #27836
* #27744
* #27781
* #27754
* #27314
* #27239
* #27076
* #27197
armenzg added a commit to getsentry/sentry that referenced this issue Jun 20, 2023
…#51040)

This PR upgrades all projects that do not have auto-update disabled to
the 2023-01-11 grouping config. This will happen as events for the
project happen.

Customers that want to override [any of the values from the enhancers in
this
release](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
can do so by using the project's [Stack Trace Rules under Issue
Grouping](https://docs.sentry.io/product/data-management-settings/event-grouping/stack-trace-rules/).
<img width="829" alt="image"
src="https://github.com/getsentry/sentry/assets/44410/fd06e3d3-8f7b-438d-9a96-8431aa511a0f">

For instance, this change:
`family:native package:/lib/** -app`
can be overwritten with:
`family:native package:/lib/** +app`

### Changes in this release
The
[2023-01-11](https://github.com/getsentry/sentry/blob/42a860c4fd13672cb3fa3384ede490654de44e0f/src/sentry/grouping/strategies/configurations.py#L189-L202)
group config has the following changes:
* A Java grouping fix:
[java_cglib_hibernate_logic](#45185)
* [A bunch of stacktrace
enhancers](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
(based on the mobile enhancers)
  * More info in section 2

#### Java change

From: #45185 behind the
`java_cglib_hibernate_logic` branch:

Do not consider these as inApp:
- `$EnhancerBy...$`
- `$FastClassBy...$`
- `$HibernateProxy$`

Fixes getsentry/sentry-java#1018

#### Stack Trace Rules Enhancers

[The
file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
has a bunch of enhancers. You can review the `pynsap` changes in the PR
to get a sense of the changes.

This is based off [the mobile enhancers
file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/[email protected]).
It basically adds the following [extra
rules](https://github.com/getsentry/sentry/blob/8ef3e68d626d06859960a630a46296d52a9b93dc/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt#L404-L463).

All the PRs listed below are also part of [this
milestone](https://github.com/getsentry/sentry/milestone/50?closed=1).

The enhancements on top of the mobile enhancers includes these PRs (from
[this historical
view](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)):
* #45423
* #44761

The changes for the mobile enhancers can be seen
[here](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/mobile%402021-04-02.txt):
* #28669
* #28069
* #27994
* #27880
* #27836
* #27744
* #27781
* #27754
* #27314
* #27239
* #27076
* #27197

---------

Co-authored-by: Armen Zambrano G <[email protected]>
Co-authored-by: Arpad Borsos <[email protected]>
17hogeju pushed a commit to getsentry/sentry that referenced this issue Jun 20, 2023
…#51040)

This PR upgrades all projects that do not have auto-update disabled to
the 2023-01-11 grouping config. This will happen as events for the
project happen.

Customers that want to override [any of the values from the enhancers in
this
release](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
can do so by using the project's [Stack Trace Rules under Issue
Grouping](https://docs.sentry.io/product/data-management-settings/event-grouping/stack-trace-rules/).
<img width="829" alt="image"
src="https://github.com/getsentry/sentry/assets/44410/fd06e3d3-8f7b-438d-9a96-8431aa511a0f">

For instance, this change:
`family:native package:/lib/** -app`
can be overwritten with:
`family:native package:/lib/** +app`

### Changes in this release
The
[2023-01-11](https://github.com/getsentry/sentry/blob/42a860c4fd13672cb3fa3384ede490654de44e0f/src/sentry/grouping/strategies/configurations.py#L189-L202)
group config has the following changes:
* A Java grouping fix:
[java_cglib_hibernate_logic](#45185)
* [A bunch of stacktrace
enhancers](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
(based on the mobile enhancers)
  * More info in section 2

#### Java change

From: #45185 behind the
`java_cglib_hibernate_logic` branch:

Do not consider these as inApp:
- `$EnhancerBy...$`
- `$FastClassBy...$`
- `$HibernateProxy$`

Fixes getsentry/sentry-java#1018

#### Stack Trace Rules Enhancers

[The
file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)
has a bunch of enhancers. You can review the `pynsap` changes in the PR
to get a sense of the changes.

This is based off [the mobile enhancers
file](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/[email protected]).
It basically adds the following [extra
rules](https://github.com/getsentry/sentry/blob/8ef3e68d626d06859960a630a46296d52a9b93dc/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt#L404-L463).

All the PRs listed below are also part of [this
milestone](https://github.com/getsentry/sentry/milestone/50?closed=1).

The enhancements on top of the mobile enhancers includes these PRs (from
[this historical
view](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/newstyle%402023-01-11.txt)):
* #45423
* #44761

The changes for the mobile enhancers can be seen
[here](https://github.com/getsentry/sentry/commits/master/src/sentry/grouping/enhancer/enhancement-configs/mobile%402021-04-02.txt):
* #28669
* #28069
* #27994
* #27880
* #27836
* #27744
* #27781
* #27754
* #27314
* #27239
* #27076
* #27197

---------

Co-authored-by: Armen Zambrano G <[email protected]>
Co-authored-by: Arpad Borsos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment