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

Replace InstrumentedExtension with wildcard listener #1085

Open
timkimadobe opened this issue Oct 3, 2024 · 0 comments
Open

Replace InstrumentedExtension with wildcard listener #1085

timkimadobe opened this issue Oct 3, 2024 · 0 comments
Labels
task Item that can be completed as a standalone code change or is part of an epic.Used by issue templates

Comments

@timkimadobe
Copy link
Contributor

timkimadobe commented Oct 3, 2024

Task description

Currently InstrumentedExtension is used to capture events sent through the EventHub using a wildcard event handler, but this has downsides:

  1. Impacts extension registration process
    1. Processing time/operations to register this extension
    2. EventHub shared state event for the InstrumentedExtension
  2. No easy way to get a reference to the extension instance itself

These can be addressed by replacing this implementation in TestBase with a wildcard listener registered with MobileCore:

public typealias EventListener = (Event) -> Void

MobileCore.registerEventListener(type: EventType.wildcard, source: EventSource.wildcard, listener: EventCollector)

Where EventCollector (name not set in stone) is an implementation of the EventListener type

Breaking change

Note that removing InstrumentedExtension will be a breaking change of two categories:

  1. Direct usage
  2. Indirect extension startup event expectations (vast majority of usage cases)

Direct usage
IdentityIntegrationTests.swift:

MobileCore.unregisterExtension(InstrumentedExtension.self) {

  • Fix: direct usage just needs to be removed, since TestBase will handle the (un)registration of the new wildcard listener

NetworkResponseHandlerFunctionalTests.swift: https://github.com/adobe/aepsdk-edge-ios/blob/726f7b158a80fea0b827ceca5ddc9e71932689bf/Tests/FunctionalTests/NetworkResponseHandlerFunctionalTests.swift#L33

  • This actually is not required even today, since TestBase already registers this extension in its per-test-case setup code
  • Fix: remove InstrumentedExtension from this list

Indirect extension startup event expectations
Once removed, these test cases will need to reduce their expected event counts to account for the removal of the InstrumentedExtension.

Usage search: https://github.com/search?q=org%3Aadobe+InstrumentedExtension&type=code&p=1

Addresses the deprecation in: #1084

Additional implementation details or code snippet(s)

No response

@timkimadobe timkimadobe added the task Item that can be completed as a standalone code change or is part of an epic.Used by issue templates label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Item that can be completed as a standalone code change or is part of an epic.Used by issue templates
Projects
None yet
Development

No branches or pull requests

1 participant