Package growthbook.sdk.java.plugin
Interface GrowthBookPlugin
- All Known Implementing Classes:
GrowthBookTrackingPlugin
public interface GrowthBookPlugin
A plugin that can observe experiment and feature evaluations on a GrowthBook
instance. Mirrors the plugin contracts in the GrowthBook Python and Go SDKs.
Implementations MUST be thread-safe. All methods default to no-ops so
custom plugins only override what they need. Methods should return quickly
(enqueue work, don't block evaluation). Exceptions thrown by these methods
are caught by PluginRegistry so one failing plugin can't break
evaluation or other plugins.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Invoked when the owning GrowthBook instance is closed.default voidinit()Called once when the plugin is registered with a GrowthBook instance.default <V> voidonExperimentViewed(Experiment<V> experiment, ExperimentResult<V> result) Invoked after a user is bucketed into an experiment (once per unique hashAttribute/hashValue/experiment.key/variation combination).default <V> voidonFeatureEvaluated(String featureKey, FeatureResult<V> result) Invoked every time a feature is evaluated.
-
Method Details
-
init
default void init()Called once when the plugin is registered with a GrowthBook instance. If this throws, the plugin is treated as failed and receives no further events (seePluginRegistry). -
onExperimentViewed
Invoked after a user is bucketed into an experiment (once per unique hashAttribute/hashValue/experiment.key/variation combination). -
onFeatureEvaluated
Invoked every time a feature is evaluated. -
close
default void close()Invoked when the owning GrowthBook instance is closed. Implementations should flush any buffered work synchronously. MUST be safe to call multiple times and even ifinit()failed.
-