embrace-io / embrace-apple-sdk

Embrace's Swift SDK built on OpenTelemetry
https://embrace.io/docs/ios/
Apache License 2.0
117 stars 11 forks source link

Adds EmbraceConfigurable. Allows Option to be passed in when app_id not present to override EmbraceConfig behavior #56

Closed atreat closed 1 month ago

atreat commented 2 months ago

The existing EmbraceConfig object becomes a pass through to the underlying implementation/delegate. This is an object that conforms to the EmbraceConfigurable protocol. This protocol declares the properties that the SDK uses during its runtime. It also includes an update method that is used if/when the implementation should refresh its values (if necessary).

This PR includes a static implementation of EmbraceConfigurable called DefaultConfig, which is the default object when initializing Embrace.Options without an Embrace appId.

It also includes an implementation, RemoteConfig, which implements the retrieval of config from the Embrace Config service. This is only available when an Embrace appId is present.

github-actions[bot] commented 2 months ago

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

github-actions[bot] commented 2 months ago
Warnings
:warning: No CHANGELOG entry added.
:warning: **Sources/EmbraceCore/Embrace.swift#L261** - Files should have a single trailing newline (`trailing_newline`)
:warning: **Tests/TestSupport/TestConstants.swift#L13** - Prefer non-optional `Data(_:)` initializer when converting `String` to `Data` (`non_optional_string_data_conversion`)

Generated by :no_entry_sign: Danger Swift against 0148e21b60ded93652d51285f101e7c41228ccf2

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 91.98370% with 59 lines in your changes missing coverage. Please review.

Project coverage is 91.94%. Comparing base (fe3675e) to head (0148e21). Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...lTests/EmbraceConfigurable/RemoteConfigTests.swift 83.08% 23 Missing :warning:
...ts/TestSupport/Mocks/MockEmbraceConfigurable.swift 74.57% 15 Missing :warning:
Sources/EmbraceConfigInternal/EmbraceConfig.swift 85.18% 4 Missing :warning:
...figuration/EmbraceConfigurable/DefaultConfig.swift 75.00% 3 Missing :warning:
...braceConfiguration/NetworkPayloadCaptureRule.swift 78.57% 3 Missing :warning:
Sources/EmbraceCore/Internal/Embrace+Config.swift 86.95% 3 Missing :warning:
Tests/TestSupport/EditableConfig.swift 83.33% 3 Missing :warning:
...figInternal/EmbraceConfigurable/RemoteConfig.swift 96.55% 2 Missing :warning:
...urable/RemoteConfig/RemoteConfigFetcherTests.swift 98.56% 2 Missing :warning:
Sources/EmbraceCore/Embrace.swift 50.00% 1 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56/graphs/tree.svg?width=650&height=150&src=pr&token=R3KMG2Ar52&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io)](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io) ```diff @@ Coverage Diff @@ ## main #56 +/- ## ========================================== + Coverage 91.93% 91.94% +0.01% ========================================== Files 400 408 +8 Lines 26024 26364 +340 ========================================== + Hits 23924 24240 +316 - Misses 2100 2124 +24 ``` | [Files with missing lines](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io) | Coverage Δ | | |---|---|---| | [...eCommonInternal/Identifiers/DeviceIdentifier.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceCommonInternal%2FIdentifiers%2FDeviceIdentifier.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29tbW9uSW50ZXJuYWwvSWRlbnRpZmllcnMvRGV2aWNlSWRlbnRpZmllci5zd2lmdA==) | `95.45% <100.00%> (+62.12%)` | :arrow_up: | | [.../EmbraceConfigInternal/EmbraceConfig+Options.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceConfigInternal%2FEmbraceConfig%2BOptions.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29uZmlnSW50ZXJuYWwvRW1icmFjZUNvbmZpZytPcHRpb25zLnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [...nfigurable/RemoteConfig/RemoteConfig+Options.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceConfigInternal%2FEmbraceConfigurable%2FRemoteConfig%2FRemoteConfig%2BOptions.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29uZmlnSW50ZXJuYWwvRW1icmFjZUNvbmZpZ3VyYWJsZS9SZW1vdGVDb25maWcvUmVtb3RlQ29uZmlnK09wdGlvbnMuc3dpZnQ=) | `100.00% <100.00%> (ø)` | | | [...onfigurable/RemoteConfig/RemoteConfigFetcher.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceConfigInternal%2FEmbraceConfigurable%2FRemoteConfig%2FRemoteConfigFetcher.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29uZmlnSW50ZXJuYWwvRW1icmFjZUNvbmZpZ3VyYWJsZS9SZW1vdGVDb25maWcvUmVtb3RlQ29uZmlnRmV0Y2hlci5zd2lmdA==) | `87.50% <100.00%> (ø)` | | | [...onfigurable/RemoteConfig/RemoteConfigPayload.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceConfigInternal%2FEmbraceConfigurable%2FRemoteConfig%2FRemoteConfigPayload.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29uZmlnSW50ZXJuYWwvRW1icmFjZUNvbmZpZ3VyYWJsZS9SZW1vdGVDb25maWcvUmVtb3RlQ29uZmlnUGF5bG9hZC5zd2lmdA==) | `100.00% <ø> (ø)` | | | [...urces/EmbraceConfiguration/InternalLogLimits.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceConfiguration%2FInternalLogLimits.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29uZmlndXJhdGlvbi9JbnRlcm5hbExvZ0xpbWl0cy5zd2lmdA==) | `100.00% <100.00%> (ø)` | | | [...kPayloadCapture/NetworkPayloadCaptureHandler.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceCore%2FCapture%2FNetwork%2FNetworkPayloadCapture%2FNetworkPayloadCaptureHandler.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29yZS9DYXB0dXJlL05ldHdvcmsvTmV0d29ya1BheWxvYWRDYXB0dXJlL05ldHdvcmtQYXlsb2FkQ2FwdHVyZUhhbmRsZXIuc3dpZnQ=) | `90.59% <ø> (-1.30%)` | :arrow_down: | | [...workPayloadCapture/URLSessionTaskCaptureRule.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceCore%2FCapture%2FNetwork%2FNetworkPayloadCapture%2FURLSessionTaskCaptureRule.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29yZS9DYXB0dXJlL05ldHdvcmsvTmV0d29ya1BheWxvYWRDYXB0dXJlL1VSTFNlc3Npb25UYXNrQ2FwdHVyZVJ1bGUuc3dpZnQ=) | `88.63% <ø> (ø)` | | | [...raceCore/Internal/Logs/DefaultInternalLogger.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceCore%2FInternal%2FLogs%2FDefaultInternalLogger.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29yZS9JbnRlcm5hbC9Mb2dzL0RlZmF1bHRJbnRlcm5hbExvZ2dlci5zd2lmdA==) | `87.50% <100.00%> (+4.76%)` | :arrow_up: | | [Sources/EmbraceCore/Options/Embrace+Options.swift](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree&filepath=Sources%2FEmbraceCore%2FOptions%2FEmbrace%2BOptions.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io#diff-U291cmNlcy9FbWJyYWNlQ29yZS9PcHRpb25zL0VtYnJhY2UrT3B0aW9ucy5zd2lmdA==) | `84.00% <100.00%> (+0.66%)` | :arrow_up: | | ... and [19 more](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io) | | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/embrace-io/embrace-apple-sdk/pull/56/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=embrace-io)