Skip to content

Conversation

@dustinbyrne
Copy link
Contributor

@dustinbyrne dustinbyrne commented Dec 18, 2025

This change adds observability into feature flag evaluation failures by including a $feature_flag_error property on $feature_flag_called events. The error types are:

Error Type Description
timeout Request timed out (context deadline, cancellation, net.Error timeout)
connection_error Network connectivity issues (DNS errors, connection refused)
errors_while_computing_flags Server returned errorsWhileComputingFlags: true
quota_limited Feature flags quota exceeded
flag_missing Requested flag not in API response
api_error_* HTTP error status codes (e.g., api_error_500, api_error_503)
unknown_error Unexpected error that doesn't match known patterns

Multiple errors can occur simultaneously and are joined with commas (e.g., timeout,flag_missing).

@dustinbyrne dustinbyrne force-pushed the feat/feature-flag-error branch from 45cc034 to 1c89468 Compare December 19, 2025 20:05
@dustinbyrne dustinbyrne marked this pull request as ready for review December 19, 2025 20:05
@dustinbyrne dustinbyrne requested a review from a team December 19, 2025 20:07
@posthog-project-board-bot posthog-project-board-bot bot moved this to In Review in Feature Flags Dec 19, 2025
Copy link
Contributor

@haacked haacked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

The unit tests for classifyError() and GetErrorString() are excellent, but I don't see integration tests verifying that $feature_flag_error actually gets set on captured events. Maybe add a test following the pattern in feature_flags_flags_test.go?

@github-project-automation github-project-automation bot moved this from In Review to Approved in Feature Flags Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

3 participants