Send custom tags via DSN

Hi,

I’m trying to send custom tags via the DSN string, which in my case is an environment variable. However, I’m having trouble to get Sentry recognize the tags.

I’m creating and environment variable called SENTRY_DSN with value: “https://c6a31b02b7b94488becc37314d94bf86@xxx.com/4?tags=platform:azure

When I execute the basic Java example I get the tags in my Sentry panel.

However, when I try to run my own Java applications I get nothing. Maybe it is because I’m using the Logback backend and it doesn’t support DSN with options?

Anyone has any idea of why this happens?

Setting tags through the DSN is a feature that only our Java SDK supports and will most likely no longer be supported in the future.
Reason being is very it’s very intransparent and fragile.
Please use functions like addExtra as described here: https://docs.sentry.io/clients/java/context/#usage

Ok, thanks for the info!

Do you know if there’s another way to send custom tags without modifying the code itself? I can modify the source code, but I prefer not to do it because I’m using the Logback integration to not have to touch the Java code

The SDK supports MDC too. If logback allows you to specifcy MDC tags via configuration, they’ll show up in Sentry.

1 Like