Skip to content

Unable to capture server exceptions with Sentry #62

@Gunni

Description

@Gunni

I am trying to use sentry_sdk to capture exceptions in the varlink api.

So far the only way i have found is to wrap varlink.RequestHandler like this:

class ServiceRequestHandler(varlink.RequestHandler):
    service = service

    def __init__(self, *args, **kwargs):
        with sentry_sdk.start_transaction(op='fallback', name='ServiceRequestHandler') as t:
            try:
                super().__init__(*args, **kwargs)
            except:
                sentry_sdk.capture_exception()
                raise

The problem is that this starts a new transaction instead of using the one i already made:

@service.interface('com.example')
class Example:
    def Add(self, something):
        with sentry_sdk.start_transaction(op='call', name=f'{Path(__file__).name}::Add'):
            ...

And my workaround also marks all the exceptions i do get as "handled" because of how I captured them.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions