Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add OptionConfiguration #1888

Draft
wants to merge 9 commits into
base: feat/create-cli-config
Choose a base branch
from

Conversation

bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Nov 6, 2024

Fixes #1621

Based on the issue description: The aim is to have users no longer need to know or care about Runtime and BuildTime differences. They write their code in once place, we use the same options at any time.

If the need arises to set native-specific options - i.e. to set the sample-rate on the native layer, we provide NativeOverrides on the options themselves.

public override void Configure(SentryUnityOptions options)
{
    // Here you can programmatically modify the Sentry option properties used for the SDK's initialization

    options.Environment = "dev";

    options.NativeOverrides.Environment = "native_dev";
    options.NativeOverrides.SampleRate = 0.1f;
}

The downside (and a possible footgun for us): We need to be careful when modifying or adding options on the native layer to make sure we use the overrides and if those are null, fall back to the actual options.

Copy link
Contributor

github-actions bot commented Nov 6, 2024

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Add `OptionConfiguration` ([#1888](https://github.com/getsentry/sentry-unity/pull/1888))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 08ed47d


options.Environment = "dev";

options.NativeOverrides.Environment = "native_dev";
Copy link
Member

@bruno-garcia bruno-garcia Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a real use case though?
Shouldn't we just take the dev above and automatically override native?

I see this makes sense for things that only the native layer has though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants