Skip to content

Feature request: ability to explicitly control offline mode #489

@johnwchadwick

Description

@johnwchadwick

We have an application where we want to withhold network requests until/unless consent is given. To that end, it is possible today to implement a beforeSend hook that simply drops events, but this is unideal, as it would also drop events while our app is still loading and the settings model is inaccessible. In addition, it isn't entirely clear to me whether beforeSend is called before every network request; for example, are minidump uploads covered by this?

Assuming that Sentry will not attempt to make any kind of network requests outside of the Transport implementation that gets passed in, it is possible to implement this by simply making a transport which queues requests until we have consent given. And in fact, it seems like all of the functionality necessary to implement this already exists in ElectronOfflineNetTransport, but there is no possible way to adjust the maybeOnline check to include additional bits. So today, you would have to copy this code out and vendor it just to add this small capability.

I have a just a few questions that I would be very appreciative to have answered:

  • Does every single network request to the Sentry service go through Transport? (i.e. could we fully block network traffic using only this mechanism?)

  • If so, would you accept pull requests for some sort of mechanism that lets us control when the ElectronOfflineNetTransport decides to queue? Not sure exactly how. It could be as simple as making the maybeOnline function a protected method of the class that can be overridden.

  • If not, is there a better way I can accomplish what I want? Or is it best to simply vendor the ElectronOfflineNetTransport and modify it slightly?

I hope my feature request/questions are clear enough. Thanks!

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