You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(core): Add `localEvaluation` API
* feat(core): Add an optional shutdown override to Feature Flags
* docs(core): Update CHANGELOG
* feat(server): Add feature flags local evaluation
* docs(server): Update CHANGELOG
* docs(server): Update USAGE
* chore: Update Java sample to include local eval
* Don't shadow reserved keyword identifiers
* Drop a list allocation
* Add enums for property operators and types
* Regex patterns are static
* Separate duties in feature flags
This cleans things up for future `onlyEvaluateLocally` config and
sending feature flags on capture
* refactor: Move local eval models to core
Deserialization is handled here, paired closely with the Api. This
simplifies deserialization in the server SDK.
* refactor: Use deserialization from core
* fix: Flag definitions are loaded synchronously if missing
* fix: Use group properties when evaluating group flags
* test: Use JSON objects
* test: Add flag dependency tests
This brings method coverage to 92% overall, line 85% overall.
* fix: Mark the poller as daemon
It'll automatically clean up in case the developer forgets to call
posthog.close()
* chore(java-sample): Move logic out of onFeatureFlags
It's not necessary considering the first request to trigger local
evaluation will synchronously retrieve flag definitions if they're not
yet loaded.
* docs(core): Update CHANGELOG
* chore(server): apply formatter
* fix: Properly type `userProperties`/`groupProperties`
* feat: Setting `personalApiKey` turns local eval on by default
* fix(server): Skip flags with ensure_experience_continuity
* refactor(server): Inherit `PostHogStateless`
Aggregation makes it difficult to access `featureFlags` without exposing
it
* feat(server): Add `reloadFeatureFlags` method
This reloads feature flag definitions, and is present in other
server-side SDKs
* fix(server): Improve synchronization of flag definitions
Previously the synchronization prevented flag definitions from being
overwritten. This now ensures the poller and the client don't load flag
definitions at the same time.
* fix(server): Catch errors on feature flag init
* style: Fix up a comment
* fixup! style: Fix up a comment
* style: Missing newline
* style: spotlessApply
* chore: apiDump
* test: Use a latch to reduce flakiness in CI
Copy file name to clipboardExpand all lines: posthog-server/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
## Next
2
2
3
+
- feat: Add local evaluation for feature flags ([#299](https://github.com/PostHog/posthog-android/issues/299))
3
4
- fix: Restructured `groupProperties` and `userProperties` types to match the API and other SDKs ([#312](https://github.com/PostHog/posthog-android/pull/312))
Copy file name to clipboardExpand all lines: posthog-server/api/posthog-server.api
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
public final class com/posthog/server/PostHog : com/posthog/server/PostHogInterface {
1
+
public final class com/posthog/server/PostHog : com/posthog/PostHogStateless, com/posthog/server/PostHogInterface {
2
2
public static final field Companion Lcom/posthog/server/PostHog$Companion;
3
3
public fun <init> ()V
4
4
public fun alias (Ljava/lang/String;Ljava/lang/String;)V
@@ -25,6 +25,7 @@ public final class com/posthog/server/PostHog : com/posthog/server/PostHogInterf
25
25
public fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;Lcom/posthog/server/PostHogFeatureFlagOptions;)Z
26
26
public fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;Z)Z
27
27
public fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;ZLjava/util/Map;Ljava/util/Map;Ljava/util/Map;)Z
28
+
public fun reloadFeatureFlags ()V
28
29
public fun setup (Lcom/posthog/server/PostHogConfig;)V
29
30
public static final fun with (Lcom/posthog/server/PostHogConfig;)Lcom/posthog/server/PostHogInterface;
30
31
}
@@ -86,10 +87,11 @@ public class com/posthog/server/PostHogConfig {
86
87
public static final field DEFAULT_HOST Ljava/lang/String;
87
88
public static final field DEFAULT_MAX_BATCH_SIZE I
88
89
public static final field DEFAULT_MAX_QUEUE_SIZE I
90
+
public static final field DEFAULT_POLL_INTERVAL_SECONDS I
89
91
public static final field DEFAULT_US_ASSETS_HOST Ljava/lang/String;
90
92
public static final field DEFAULT_US_HOST Ljava/lang/String;
91
-
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;Ljava/net/Proxy;III)V
92
-
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;Ljava/net/Proxy;IIIILkotlin/jvm/internal/DefaultConstructorMarker;)V
93
+
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;Ljava/net/Proxy;IIIZLjava/lang/String;I)V
94
+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZIIIILcom/posthog/PostHogEncryption;Lcom/posthog/PostHogOnFeatureFlags;Ljava/net/Proxy;IIIZLjava/lang/String;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
93
95
public final fun addBeforeSend (Lcom/posthog/PostHogBeforeSend;)V
94
96
public final fun addIntegration (Lcom/posthog/PostHogIntegration;)V
95
97
public static final fun builder (Ljava/lang/String;)Lcom/posthog/server/PostHogConfig$Builder;
@@ -102,9 +104,12 @@ public class com/posthog/server/PostHogConfig {
102
104
public final fun getFlushAt ()I
103
105
public final fun getFlushIntervalSeconds ()I
104
106
public final fun getHost ()Ljava/lang/String;
107
+
public final fun getLocalEvaluation ()Z
105
108
public final fun getMaxBatchSize ()I
106
109
public final fun getMaxQueueSize ()I
107
110
public final fun getOnFeatureFlags ()Lcom/posthog/PostHogOnFeatureFlags;
111
+
public final fun getPersonalApiKey ()Ljava/lang/String;
112
+
public final fun getPollIntervalSeconds ()I
108
113
public final fun getPreloadFeatureFlags ()Z
109
114
public final fun getProxy ()Ljava/net/Proxy;
110
115
public final fun getRemoteConfig ()Z
@@ -117,9 +122,12 @@ public class com/posthog/server/PostHogConfig {
117
122
public final fun setFeatureFlagCalledCacheSize (I)V
118
123
public final fun setFlushAt (I)V
119
124
public final fun setFlushIntervalSeconds (I)V
125
+
public final fun setLocalEvaluation (Z)V
120
126
public final fun setMaxBatchSize (I)V
121
127
public final fun setMaxQueueSize (I)V
122
128
public final fun setOnFeatureFlags (Lcom/posthog/PostHogOnFeatureFlags;)V
129
+
public final fun setPersonalApiKey (Ljava/lang/String;)V
130
+
public final fun setPollIntervalSeconds (I)V
123
131
public final fun setPreloadFeatureFlags (Z)V
124
132
public final fun setProxy (Ljava/net/Proxy;)V
125
133
public final fun setRemoteConfig (Z)V
@@ -137,9 +145,12 @@ public final class com/posthog/server/PostHogConfig$Builder {
137
145
public final fun flushAt (I)Lcom/posthog/server/PostHogConfig$Builder;
138
146
public final fun flushIntervalSeconds (I)Lcom/posthog/server/PostHogConfig$Builder;
139
147
public final fun host (Ljava/lang/String;)Lcom/posthog/server/PostHogConfig$Builder;
148
+
public final fun localEvaluation (Z)Lcom/posthog/server/PostHogConfig$Builder;
140
149
public final fun maxBatchSize (I)Lcom/posthog/server/PostHogConfig$Builder;
141
150
public final fun maxQueueSize (I)Lcom/posthog/server/PostHogConfig$Builder;
142
151
public final fun onFeatureFlags (Lcom/posthog/PostHogOnFeatureFlags;)Lcom/posthog/server/PostHogConfig$Builder;
152
+
public final fun personalApiKey (Ljava/lang/String;)Lcom/posthog/server/PostHogConfig$Builder;
153
+
public final fun pollIntervalSeconds (I)Lcom/posthog/server/PostHogConfig$Builder;
143
154
public final fun preloadFeatureFlags (Z)Lcom/posthog/server/PostHogConfig$Builder;
144
155
public final fun proxy (Ljava/net/Proxy;)Lcom/posthog/server/PostHogConfig$Builder;
145
156
public final fun remoteConfig (Z)Lcom/posthog/server/PostHogConfig$Builder;
@@ -209,6 +220,7 @@ public abstract interface class com/posthog/server/PostHogInterface {
209
220
public abstract fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;Lcom/posthog/server/PostHogFeatureFlagOptions;)Z
210
221
public abstract fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;Z)Z
211
222
public abstract fun isFeatureEnabled (Ljava/lang/String;Ljava/lang/String;ZLjava/util/Map;Ljava/util/Map;Ljava/util/Map;)Z
223
+
public abstract fun reloadFeatureFlags ()V
212
224
public abstract fun setup (Lcom/posthog/server/PostHogConfig;)V
0 commit comments