# posthog
- aea1877 Refactor regex schemas out of module attributes into private functions to fix Elixir 1.18
#Referencemacro compilation crash. — Thanks @boxxxie for your first contribution 🎉!
- e4dbef7 Add
PostHog.OpenFeature.Provider, an OpenFeature provider for the Elixir OpenFeature SDK. Add{:open_feature, "~> 0.1"}to your dependencies to use it. — Thanks @seanpem for your first contribution 🎉!
- a401bd2 Stop leaking access tracker processes during OpenFeature flag evaluations. — Thanks @marandaneto!
- a481ed7 Honor the definitions snapshot property_matching_version in local feature flag evaluation and shared definition caches. Missing or version 1 now intentionally matches released service legacy boolean truthiness rather than the former SDK behavior; version 2 uses explicit equality, with recursive truthiness for empty filters. Correct known-null complements and composite equality normalization. — Thanks @marandaneto!
- c7c03fd Add local feature flag definition polling and evaluation with safe remote fallback. — Thanks @marandaneto!
- 7e14b2a Return an empty feature flag snapshot without evaluation when feature flag keys are explicitly empty. — Thanks @marandaneto!
- 35087c1 Keep gzip-compressed request bodies valid across retries — Thanks @marandaneto!
- 4fed56b Send minimal
$feature_flag_calledevents when the/flagsresponse carries the server-controlledminimalFlagCalledEventsgate and the evaluated flag reportshas_experiment: false. Minimal events keep only an allowlisted set of properties (flag identity, evaluation metadata,$groups,$process_person_profile,$session_id,$lib,$lib_version,$is_server); everything else, including context and global properties, is stripped. Experiment-linked flags and responses without the gate keep the full event shape. — Thanks @haacked!
- d66f174 Emit error tracking stack frames in canonical bottom-up order:
frames[0]is the outermost entry point and the last frame is the crash site. This aligns the Elixir SDK with the cross-SDK stack frame ordering standard. — Thanks @cat-ph!
- dbe91ba Group captured log messages by logging call site instead of message content. Plain log messages often interpolate dynamic values (ids, URLs, inspected terms), and using the message as the exception type created a separate error tracking issue for every distinct message. The exception type is now
Logger <level> (<Module.function/arity>)when call-site metadata is available; the full message remains in the exception value. — Thanks @cat-ph!
- 673ec2c Add a
$feature_flag_has_experimentboolean property to$feature_flag_calledevents, sourced from thehas_experimentfield in the/flagsresponse metadata. The property is only sent when the server explicitly reports the field; it is omitted when unknown (older deployments). — Thanks @haacked!
- d1b8ed9 Require Req 0.6.1 or newer to avoid vulnerable 0.5.x and 0.6.0 releases. — Thanks @dustinbyrne!
- a014220 Add before_send callback support for filtering captured events — Thanks @marandaneto!
- 742e3d8 Add source location stacktrace frames for plain Logger messages. — Thanks @hpouillot!
- 45cba19 Fall back to uncompressed API requests when gzip compression fails — Thanks @marandaneto!
- 4d2af12 Dedupe feature flag called events by response — Thanks @marandaneto!
- e086cb7 Add PostHog.LLMAnalytics.pop_span/1 function for convenient span context handoff between processes — Thanks @martosaur!
- 4aa5504 relax Req and uuid-v7 version requirements — Thanks @martosaur!
- 31b1d0f Send a
posthog-elixir/<version>User-Agent header on all API requests so PostHog recognizes the SDK as server-side and includes flags gated to the server runtime in/flagsresponses. — Thanks @haacked!
- 8672156 Add a configurable
$is_serverevent property (defaulttrue) so PostHog can identify server-side events. Setis_server: falsewhen using posthog-elixir as a client/CLI so the device OS is attributed normally. — Thanks @turnipdabeets for your first contribution 🎉!
- 5d18b01 Start in disabled/no-op mode instead of raising or sending events when the API key is missing, blank, or the supervisor is unavailable. — Thanks @marandaneto!
- 98f1308 Improve error tracking grouping by always using arity to format stacktrace frames — Thanks @martosaur!
- b737a36 Improve events batching logic and prevent SDK from sending empty batches — Thanks @martosaur!
- 68baae7 Do not count
get_flag_payload/2calls as accesses foronly_accessed/1. — Thanks @dustinbyrne!
-
65d520d Add
PostHog.FeatureFlags.evaluate_flags/2and thePostHog.FeatureFlags.Evaluationssnapshot so a single/flagscall can power both flag branching and event enrichment for one request:{:ok, snapshot} = PostHog.FeatureFlags.evaluate_flags("user-123") if PostHog.FeatureFlags.Evaluations.enabled?(snapshot, "new-dashboard") do render_new_dashboard() end PostHog.FeatureFlags.set_in_context(snapshot) PostHog.capture("page_viewed", %{distinct_id: "user-123"})
The snapshot exposes
enabled?/2,get_flag/2,get_flag_payload/2,only/2,only_accessed/1,accessed/1,keys/1, andevent_properties/1. Passflag_keys: [...]toevaluate_flags/2to scope the underlying/flagsrequest itself. Whendistinct_idcannot be resolved,evaluate_flags/2returns an empty snapshot whose accessors are no-ops (matching the cross-SDK behavior).$feature_flag_calledevents fired fromcheck/3,check!/3,get_feature_flag_result/4, and the new snapshot path now attach$feature_flag_id,$feature_flag_version,$feature_flag_reason,$feature_flag_request_id,$feature_flag_payload,$feature/<key>, and$feature_flag_error(combiningerrors_while_computing_flagsand, on the snapshot path,flag_missing) when the response provides them. JSON-encoded payloads in/flagsresponses are now decoded before being attached to events and the:payloadfield on%PostHog.FeatureFlags.Result{}. The struct also gains:id,:version,:reason,:request_id,:evaluated_at, and:errors_while_computing.check/3,check!/3,get_feature_flag_result/4, andget_feature_flag_result!/4are now marked@deprecatedand emit compile-time warnings pointing atevaluate_flags/2. They continue to return the same values; removal is planned for the next major. — Thanks @dmarticus!
- 48baad3 Default api_host when omitted — Thanks @marandaneto!
- 43cbfcc Populate Plug request context from PostHog tracing headers. — Thanks @dustinbyrne!
- f3fbed3 Trim surrounding whitespace from api_key and api_host config before validation and use — Thanks @marandaneto!
- 8d21cc8 Add source code context to error tracking stack frames, and fix exception value formatting. — Thanks @cat-ph!
- 12bcef3 Improve Error Tracking for complex errors. If an error has a
crash_reason, which is common for OTP reports, the SDK will report it as a chain of two exceptions. Additionally, some valuable information, such as process label, genserver state or last message, will be extracted from the report and put into event properties. — Thanks @martosaur!
- 0f1f78e This is technically a breaking change because we're now always sending data gzip compressed and people might not want that, but this will not break anyone's code so we'll release it as a minor knowing that it's an improvement. It's always been possible to swap the client off, but we weren't documenting how to do that exactly - this is now solved too. — Thanks @rafaeelaudibert!
- ba2f10a Implement proper retry behavior for requests. Also respects X-Retry-Later header. — Thanks @rafaeelaudibert!
- 39a304d We've now added a new
get_feature_flag_resultmethod that can be used to get a full view of your feature flags including the payload rather than simply a boolean/string from the enabled/variant state. — Thanks @rafaeelaudibert! - 1dc5271 Add support for Anthropic messages in the LLM analytis module — Thanks @rafaeelaudibert!
-
4069a8e Add LLM Analytics
This release introduces a lightweight LLM analytics toolkit for instrumenting, recording, and analyzing large language model usage across applications that use this repository's SDK. It provides practical observability for teams running LLMs in production and during development. — Thanks @martosaur!
-
5fec2fd Add
uuidto events on every request to guarantee idempotency in the backend — Thanks @rafaeelaudibert! -
927c1b4 New release process via sampo — Thanks @rafaeelaudibert!
- included evaluated_at properties in $feature_flag_called events
7c7ee1e978164809aa28162824f273f6f2bd33f2
posthog-elixir was fully reworked. Check migration guide
for some tips on how to upgrade.
Huge thanks to community member @martosaur for contributing this new version.
- Elixir v1.17+ required
- Event capture is now offloaded to background workers with automatic batching
- Context mechanism for easier property propagation
- Error Tracking support
- New
PostHog.FeatureFlagsmodule for working with feature flags - Test mode for easier testing
- Customizable HTTP client with Req as the default
- Plug integration for automatically capturing common HTTP properties
- Expose
capture/2b077aba849126c63f1c7a82b6ad9d21945871a4a
- Fix implementation for structs
2cdc6f578a192fd751ce105018a7f78b7ed8f852
- More small changes to docs
147795c21a58e2308fbd43b571d9ba978c8a8a3b
- Small changes to docs
f3578a7006fb8d6cb19f36e19b1387243a12bd21
posthog-elixir is now officially stable and running on v1. There are some breaking changes and some general improvements. Check MIGRATION.md for a guide on how to migrate.
- Elixir v1.14+ is now a requirement
- Feature Flags now return a key called
payloadrather thanvalueto better align with the other SDKs - PostHog now requires you to initialize
Posthog.Applicationalongside your supervisor tree. This is required because of ourCachexsystem to properly track your FF usage.- We'll also include local evaluation in the near term, which will also require a GenServer, therefore, requiring us to use a Supervisor.
- Added
enabled_captureconfiguration option to disable PostHog tracking in development/test environments PostHog.capturenow requiresdistinct_idas a required second argument
Fix inconsistent docs for properties - [#13]
Improve docs setup - [#12]
Allow atom() property keys - [#11]
Fix feature flags broken implementation - [#10]
Documentation + OTP/Elixir version bumps
- Initial feature flags implementation (#7)
- Allow extra headers (#3)
- Initial release