Skip to content

get_experiment_flag(), $flag_exposure event #232

Description

@khvn26

The SDK cannot send an exposure event:

  • PipelineAnalyticsProcessor.record_custom_event() sets the value field to None.
  • The event schema of the SDK has no feature_name field.
  • The Flag model has no variant key.
  • The SDK sends events to v1/analytics/batch. The JavaScript client sends events to v1/events. The two schemas are not the same.

Requirements

  1. Add a get_experiment_flag(feature_name, identifier, traits=None) function to the Flagsmith client.
  2. The function must evaluate the flag for the given identifier.
  3. The function must return the flag together with its variant key.
  4. The function must send one $flag_exposure event when all these conditions are true:
    • The flag exists.
    • The flag is enabled.
    • The flag has a variant.
  5. When any condition is false, the function must not send the event. The function must log the cause.
  6. The exposure event must contain these fields: event, feature_name, identifier, value, timestamp. The event field must contain $flag_exposure. The value field must contain the variant key.
  7. The processor must not send two equal exposure events in one flush interval.
  8. The processor must use the same endpoint and the same event schema as the JavaScript client. Confirm the correct schema with the events ingest service before you start.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions