@@ -8,16 +8,15 @@ defmodule PostHog.FeatureFlags.Evaluations do
88 paying the cost of one round-trip per flag.
99
1010 Each snapshot owns a small `Agent` linked to the calling process that tracks
11- which flags were accessed via `enabled?/2`, `get_flag/2`, and
12- `get_flag_payload/2`. The Agent exits with the calling process — no manual
13- cleanup is required.
11+ which flags were accessed via `enabled?/2` and `get_flag/2`. The Agent exits
12+ with the calling process — no manual cleanup is required.
1413
1514 ## Querying
1615
1716 Use `enabled?/2`, `get_flag/2`, and `get_flag_payload/2` to read individual
18- flags. `enabled?/2` and `get_flag/2` fire a `$feature_flag_called` event
19- with full metadata (id, version, reason, request_id) on each call;
20- `get_flag_payload/2` records the access without firing an event .
17+ flags. `enabled?/2` and `get_flag/2` record access and fire a
18+ `$feature_flag_called` event with full metadata (id, version, reason,
19+ request_id) on each call; `get_flag_payload/2` does neither .
2120
2221 {:ok, snapshot} = PostHog.FeatureFlags.evaluate_flags("user-123")
2322
@@ -41,9 +40,9 @@ defmodule PostHog.FeatureFlags.Evaluations do
4140 ## Filtering
4241
4342 Use `only_accessed/1` to narrow a snapshot to flags accessed so far via
44- `enabled?/2`, `get_flag/2`, or `get_flag_payload /2`. Use `only/2` to narrow
45- by an explicit key list. Both return a fresh snapshot with its own access
46- tracker — calls on the filtered view do not back-propagate to the parent.
43+ `enabled?/2` or `get_flag /2`. Use `only/2` to narrow by an explicit key list.
44+ Both return a fresh snapshot with its own access tracker — calls on the
45+ filtered view do not back-propagate to the parent.
4746
4847 narrowed = PostHog.FeatureFlags.Evaluations.only_accessed(snapshot)
4948 PostHog.FeatureFlags.set_in_context(narrowed)
@@ -157,14 +156,13 @@ defmodule PostHog.FeatureFlags.Evaluations do
157156
158157 @ doc """
159158 Returns the configured payload for the flag, or `nil` for unknown flags or
160- flags without a payload. Records the access.
159+ flags without a payload.
161160
162- Does **not** fire a `$feature_flag_called` event.
161+ Does **not** record access for `only_accessed/1` or fire a
162+ `$feature_flag_called` event.
163163 """
164164 @ spec get_flag_payload ( t ( ) , String . t ( ) ) :: any ( ) | nil
165- def get_flag_payload ( % __MODULE__ { flags: flags } = snapshot , key ) when is_binary ( key ) do
166- record_access ( snapshot , key )
167-
165+ def get_flag_payload ( % __MODULE__ { flags: flags } , key ) when is_binary ( key ) do
168166 case Map . fetch ( flags , key ) do
169167 { :ok , % Result { payload: payload } } -> payload
170168 :error -> nil
@@ -178,8 +176,8 @@ defmodule PostHog.FeatureFlags.Evaluations do
178176 def keys ( % __MODULE__ { flags: flags } ) , do: flags |> Map . keys ( ) |> Enum . sort ( )
179177
180178 @ doc """
181- Returns the sorted list of keys accessed via `enabled?/2`, `get_flag/2`, or
182- `get_flag_payload/2` on this snapshot.
179+ Returns the sorted list of keys accessed via `enabled?/2` or `get_flag/2` on
180+ this snapshot.
183181
184182 Includes keys that were accessed but absent from the snapshot.
185183 """
@@ -190,7 +188,7 @@ defmodule PostHog.FeatureFlags.Evaluations do
190188
191189 @ doc """
192190 Returns a copy of the snapshot scoped to the flags accessed so far via
193- `enabled?/2`, `get_flag/2`, or `get_flag_payload /2`.
191+ `enabled?/2` or `get_flag /2`.
194192
195193 Returns an empty snapshot when nothing has been accessed yet — including
196194 no flags would be more surprising than helpful, since the caller asked for
0 commit comments