Skip to content

Add local feature flag evaluation support #148

Description

@marandaneto

Summary

Add local feature flag evaluation support for server-side parity.

Why

sdk-specs marks local-feature-flag-evaluator and flag-definition-loader as backend-relevant. Server SDKs commonly support low-latency flag reads by polling local-evaluation definitions with a personal API key and falling back to remote evaluation when needed.

Current status

Elixir currently calls remote /flags (PostHog.FeatureFlags.flags/2, evaluate_flags/2) and does not appear to include local evaluation, flag definition polling, ETag/stale cache handling, or external definition cache providers.

Suggested scope

  • Add config for local evaluation, including personal API key and poll interval.
  • Fetch local-evaluation definitions from the dedicated endpoint.
  • Cache definitions in memory, handle ETags/304s, and keep stale definitions on transient refresh failures.
  • Evaluate person and group flags locally, including variants and payloads.
  • Support remote fallback for inconclusive/unsupported cases.
  • Consider external/shared cache provider support for distributed deployments.
  • Add tests and docs.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions