Skip to content

Ageris 0.4.0

Choose a tag to compare

@lichtsinn lichtsinn released this 11 Oct 03:03
· 28 commits to master since this release

Ageris 0.4.0 adds an OpenFeature provider, and makes evaluate cheaper.

Get it

<dependency>
    <groupId>io.github.lichtsinn</groupId>
    <artifactId>ageris-core</artifactId>
    <version>0.4.0</version>
</dependency>
implementation 'io.github.lichtsinn:ageris-core:0.4.0'

Requires Java 17 or later.

Using Ageris through OpenFeature

OpenFeature is a vendor-neutral API for feature flags. The new module ageris-openfeature lets an application read Ageris feature flags and JSON configs through it:

<dependency>
    <groupId>io.github.lichtsinn</groupId>
    <artifactId>ageris-openfeature</artifactId>
    <version>0.4.0</version>
</dependency>
OpenFeatureAPI.getInstance().setProviderAndWait(new AgerisProvider(featureFlagManager, jsonConfigManager, loader));

Client client = OpenFeatureAPI.getInstance().getClient();
boolean active = client.getBooleanValue("enable-checkout", false, new ImmutableContext("joe"));
  • Boolean lookups are answered from the feature flags. Text, number and object lookups are answered from the JSON configs.
  • Reasons and errors are reported as OpenFeature describes them: STATIC, DEFAULT, TARGETING_MATCH, FLAG_NOT_FOUND, TYPE_MISMATCH.
  • The provider starts and stops the loader, and passes on updates and stale periods as OpenFeature events.
  • The targeting key becomes the context type user, or another type of your choice. Attributes keep their names.
  • The module brings ageris-core with it. The OpenFeature SDK is yours to add, in version 1.16.0 or later.
  • Configs of your own classes, and policies, stay on the config manager of Ageris; the same Ageris can serve both.

See Using Ageris through OpenFeature in the README.

Cheaper evaluate

evaluate returns a value together with its reason and the context that matched. It now builds the map of matches only when getMatches() is called, which most callers never do.

  • In our measurement an evaluate through two levels went from about 420 bytes per call to about 30, and took half the time.
  • Evaluation.of(value, reason, "environment", "qa", ...) creates an evaluation without a map, which is also handy in tests.
  • isActive and getConfig are unchanged: they create no objects at all.

Also changed

  • ConfigurationContext.get is now documented as the only method Ageris calls during a lookup. A subclass may override it to take its values from elsewhere.

Upgrading from 0.3.0

Nothing to do. Configuration files and the API of 0.3.0 work unchanged.

Dependencies

Unchanged from 0.3.0: Jackson 2.22, slf4j 2.0 and commons-io 2.22. ageris-core is also tested with Jackson 2.15.4, slf4j 1.7.36 and commons-io 2.11.0, and ageris-openfeature with the OpenFeature SDK from 1.16.0 to 1.23.0.