PostHog / PostHog/posthog-elixir

Deduplicate feature flag called events

Open
#149 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Elixir
Stars
65
Forks
30
Avg merge
1d 16h
Merged PRs (30d)
16

Description

Summary

Deduplicate $feature_flag_called events for repeated flag reads.

Why

sdk-specs marks feature-flag-called-tracker as applicable to both client and server SDKs. The tracker prevents noisy repeated $feature_flag_called events when application code reads the same flag/value repeatedly.

Current status

PostHog.FeatureFlags.Evaluations.enabled?/2 and get_flag/2 record access and fire $feature_flag_called on each call. No dedupe tracker was found.

Suggested scope

  • Add an internal tracker keyed by distinct ID + flag key + evaluated value/result.
  • Emit $feature_flag_called on the first read of a value.
  • Suppress duplicate events for the same user/flag/value.
  • Emit again when the value changes or the evaluation context is reset/reloaded.
  • Keep memory bounded and concurrency-safe.
  • Add tests for first read, duplicate read, and changed value.

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PostHog.FeatureFlags.Evaluations.enabled?/2 and get_flag/2, then read the sdk-specs feature-flag-called-tracker specification. Add tests covering the first read, duplicate read, changed value, context reset or reload, bounded memory, and concurrent access; done means repeated identical reads no longer emit duplicate events while changed evaluations emit again.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.