getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
203 stars 51 forks source link

DefaultTags in SentryBuildTimeOptionsConfiguration don't show up #1573

Open polynatic opened 5 months ago

polynatic commented 5 months ago

Environment

How do you use Sentry? Sentry SaaS

Which version of the SDK? 2.0.0

How did you install the package? (Git-URL, Assetstore) UPM Git-URL

Which version of Unity? 2022.3.20

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? iOS player, no other platform tested

Steps to Reproduce

1.

public class SentryBuildTimeConfiguration : SentryBuildTimeOptionsConfiguration
{
    public override void Configure(SentryUnityOptions options, SentryCliOptions cliOptions)
    {
        options.DefaultTags.Add("branch", GetGitBranch());
    }
}
  1. Create Build
  2. Run on Device

Expected Result

The branch tag appears on all Sentry events coming from this build.

Actual Result

The tag is not present on any Sentry events.

bitsandfoxes commented 5 months ago

Sorry for the confusion. The build-time options are purely used during build-time. They give you a place to hook into the CLI options and to modify mobile (iOS & Android) specific options that cannot be modified during runtime. I.e. environment or release. Tags will get propagated to all layers when set during runtime so adding those to the runtime options should do the trick.

polynatic commented 5 months ago

Alright, thanks! It would be nice if the documentation would be more clear on what properties can be set during build time, which can't be set and which ones must be set there.

bitsandfoxes commented 5 months ago

Very true. We'll update those asap.