getsentry / getsentry/sentry-cocoa
Disable SDK if initialized without a [valid] DSN
- Dominant language
- Swift
- Stars
- 1.1k
- Forks
- 418
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 106
Description
### Description
If the SDK is initialized with out a DSN, or an invalid one, then it will never be able to upload data for use by customers. But, as of today, it will still gather that data by installing its various runtime mechanisms. This incurs a performance cost with no benefit.
We will even state in a log message that the SDK failed to initialize here: https://github.com/getsentry/sentry-cocoa/blob/63f740dc5141fc10b864f36e13eedd3d8bff79dd/Sources/Sentry/SentryOptions.m#L164
Which isn't quite accurate because methods like `startTransaction` and `swizzleInstanceMethod` will still operate, which I wouldn't expect with an uninitialized SDK. For those and other top-level methods, we should check whether the SDK was successfully initialized before proceeding.
That log method should also explicitly state that, if not provided a valid DSN, the SDK will do no further work.
Contributor guide
Assessment
This issue has not been assessed yet.