Skip to content

Replace InstrumentedExtension with wildcard listener #1085

@timkimadobe

Description

@timkimadobe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    taskItem that can be completed as a standalone code change or is part of an epic.Used by issue templates

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions