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

Use default configuration for properties that are not configured using remote configuration (close #613) #614

Merged
merged 4 commits into from
Jun 29, 2023

Conversation

matus-tomlein
Copy link
Contributor

@matus-tomlein matus-tomlein commented Jun 13, 2023

Issue #613

The goal of this PR is to make the fetched or cached remote configuration use properties from the default configuration in case they are not overriden. For example, if the default config sets the appId in tracker configuration, but the fetched remote configuration doesn't change it, we should still use the app ID from the default configuraiton.

To achieve this, I decided to remove the configuration update classes. Before, each configuration had a corresponding update class (e.g., TrackerConfigurationUpdate) which purpose was to keep track of changes made to the configuration after the tracker was initialized. It remembered which properties were changed and made sure that changes are kept even if the configuration is replaced from the remote endpoint.

Instead of the update classes, I moved the logic to check for the changes directly into the configuration classes. So the TrackerConfiguration class now has the ability to have a sourceConfig tracker configuration and when a property is requested, first it is checked if it is available in the current tracker configuration and, if not, it is retrieved from the sourceConfig (this is exactly what the update class was doing before).

Having the logic directly in the configuration classes, makes it possible to have multiple levels of the configurations. In particular, we now have the following levels:

  1. The ServiceProvider has the top-most configuration. Properties of this are prioritized, but if they are not set, we go to the second level.
  2. On this level we may have the fetched or cached remote configuration. If a property is missing here, we go to the third level.
  3. This level is the default configuration. This is the final place where a property is looked for.

All these changes are internal and should not change the public API.

…fallback in remote configuration

# Conflicts:
#	snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ServiceProvider.kt
#	snowplow-tracker/src/main/java/com/snowplowanalytics/core/tracker/ServiceProviderInterface.kt
@matus-tomlein matus-tomlein force-pushed the issue/613-remote_config_defautls branch from debcc71 to 974bdb5 Compare June 21, 2023 18:50
Copy link
Contributor

@mscwilson mscwilson left a comment

Choose a reason for hiding this comment

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

LGTM!

@matus-tomlein matus-tomlein merged commit bd0c37d into release/5.3.0 Jun 29, 2023
3 checks passed
@matus-tomlein matus-tomlein deleted the issue/613-remote_config_defautls branch June 29, 2023 12:13
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.

None yet

2 participants