Skip to content

Filtering out class proxies from stacktraces (in Java) #6283

Closed

Description

@fprochazka

Hi,
I'm relatively new to Java, so I'm not sure how this really works, but Spring is using something (CGLIB?) to generate proxies and they're not really that interesting when it comes to stacktraces.

image

It would be nice, if Sentry could automatically recognize that the line in stacktrace is from a proxy and mark it as "library code".

Activity

  1. mattrobenolt commented on Oct 9, 2017

    @mattrobenolt
    Contributor

    So we should be doing that already: https://github.com/getsentry/sentry/blob/master/src/sentry/interfaces/stacktrace.py#L38-L42

    Well, not exactly that, but we should be stripping that bit out.

    When testing this manually, it seems to do the right thing.

    >>> _java_enhancer_re.sub(r'\1<auto>', 'foo$$FastClassBySprintCGLIB$$4ed8b6b')
    'foo$$FastClassBySprintCGLIB$$<auto>'
    

    Are you running a really old Sentry or something?

  2. tkaemming commented on Oct 9, 2017

    @tkaemming
    Contributor

    we should be stripping that bit out

    For clarification: the nondeterministic bits are stripped out for consideration in the grouping hash generation algorithm, but we still display it as part of the stacktrace in the UI.

  3. mattrobenolt commented on Oct 9, 2017

    @mattrobenolt
    Contributor

    Ohhh, TIL. I thought we removed it entirely from the stack itself.

  4. fprochazka commented on Oct 9, 2017

    @fprochazka
    Author

    Actually I've installed it few days ago based on the current onpremise repository in a docker container :)

    image

  5. fprochazka commented on Oct 9, 2017

    @fprochazka
    Author

    I think it's usefull info in the stack - you want to know it was called from a proxy, but it should not be marked as part of my app, since it's generated.

  6. bretthoerner commented on Oct 10, 2017

    @bretthoerner
    Contributor

    Hey @fprochazka, this sounds like a safe/fine change to me. It should probably happen on the SDK (sentry-java) side. We could have a list of special cases we check for and exclude from the app frames. In this case I assume frames containing $$FastClassBySpringCGLIB$$ would be safe to exclude.

    Do you mind opening an issue at sentry-java? I can try to get to this later this week.

  7. fprochazka commented on Oct 10, 2017

    @fprochazka
    Author

    @bretthoerner you want to not send them to sentry server at all, or just mark them somehow? I'm not sure what "exclude from the app frames" means - if it means just to not mark them as part of my application, then yay! :)

  8. bretthoerner commented on Oct 10, 2017

    @bretthoerner
    Contributor

    Ya, I assume you're using the stacktrace.app.packages config option?

    So in the SDK we won't mark frames as "in app" if they match the blacklist of regexes.

  9. fprochazka commented on Oct 10, 2017

    @fprochazka
    Author

    @bretthoerner awesome 👍

  10. bretthoerner commented on Oct 10, 2017

    @bretthoerner
    Contributor

    Cool, closing in factor of that issue.

  11. michaelgantman commented on May 29, 2018

    @michaelgantman

    I delt with the same problem and wrote a utility that smartly filters out stacktrace based on user configuration. It works very well. I published this utility as part of my MgntUtils Open Source Java library. It is available on Github (https://github.com/michaelgantman/Mgnt) and Maven Central (https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.michaelgantman%22%20AND%20a%3A%22MgntUtils%22). Here is the link to the article that explains what utilities are available in the library and how to use them: https://www.linkedin.com/pulse/open-source-java-library-some-useful-utilities-michael-gantman/

  12. locked and limited conversation to collaborators on Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions