sentry-android-gradle-plugin icon indicating copy to clipboard operation
sentry-android-gradle-plugin copied to clipboard

Simultaneous log and mapping upload to multiple servers (DSN)

Open abbasnaqdi opened this issue 1 year ago • 4 comments

Problem Statement

Hi,

For enhanced security, we require that certain logs be sent to one server (DSN), while others need to be directed to a different data source name (DSN).

To accommodate this, we need a feature that allows the simultaneous upload of files to two different servers during the release process. For instance, this would include ProGuard mapping files.

Could you please implement this functionality?

Thank you.

Solution Brainstorm

No response

abbasnaqdi avatar Dec 25 '24 13:12 abbasnaqdi

hi @abbasnaqdi Are you just asking about the gradle plugin features, which include proguard mapping upload? If so, you can achieve it by using sentry-cli directly, as our gradle plugin does under the hood

If you want to send the events to multiple DSNs, you can provide a custom ITransportFactory and ITransport, or a custom Hub/Scopes.

Would this work for you?

stefanosiano avatar Jan 08 '25 16:01 stefanosiano

@abbasnaqdi did you have any time to look into this yet?

markushi avatar Jan 15 '25 13:01 markushi

Closing for now as this seems to be a very rare edge case.

markushi avatar Jan 29 '25 13:01 markushi

Hi @stefanosiano and @markushi,

Thanks for your responses. I understand that using sentry-cli manually can achieve this, but my request is specifically for built-in support within the Sentry Gradle plugin.

I do not want to send a single event to multiple DSNs. Instead, I need only one DSN to be active at a time, depending on the Android flavor or dynamically in runtime. However, during the build process, I require all mapping files (ProGuard, source context, etc.) to be uploaded to multiple DSNs. This ensures that, at runtime, I can dynamically switch between DSNs based on the active flavor, without missing symbolization data.

Since I don't need to send events to multiple DSNs simultaneously, implementing a custom ITransport is unnecessary. The problem is solely with mapping file uploads.

Proposed Solution

It would be ideal if the Gradle plugin natively supported multiple DSNs for mapping uploads, like this:

sentry {
    org = "my-org"
    project = "my-project"

    dsn = "https://dsn1.ingest.sentry.io/1234" // Active at runtime
    additionalDsn = listOf(
        "https://dsn2.ingest.sentry.io/5678", 
        "https://dsn3.ingest.sentry.io/9012"
    )

    uploadNativeSymbols = true
    autoUploadProguardMapping = true
    autoUploadSourceContext = true
}

This way, only one DSN is used for events at runtime, but mapping files are uploaded to all DSNs during build time, ensuring full symbolization support when switching DSNs dynamically.

Thanks!

abbasnaqdi avatar Feb 28 '25 01:02 abbasnaqdi