Crate eppo

Source
Expand description

The Rust SDK for Eppo, a next-generation feature flagging and experimentation platform.

§Overview

The SDK revolves around a Client that evaluates feature flag values for “subjects”, where each subject has a unique key and key-value attributes associated with it. Feature flag evaluation results in an AssignmentValue being returned, representing a specific feature flag value assigned to the subject.

§Typed assignments

Every Eppo flag has a return type that is set once on creation in the dashboard. Once a flag is created, assignments in code should be made using the corresponding typed function:

These functions provide additional type safety over Client::get_assignment() as they can detect type mismatch even before evaluating the feature, so the error is returned even if subject is otherwise uneligible (get_assignment() return Ok(None) in that case).

§Assignment logger

An AssignmentLogger should be provided to save assignment events to your storage, facilitating tracking of which user received which feature flag values.

let config = ClientConfig::from_api_key("api-key").assignment_logger(|assignment| {
  println!("{:?}", assignment);
});

§Error Handling

Errors are represented by the Error enum.

In production, it is recommended to ignore all errors, as feature flag evaluation should not be critical enough to cause system crashes. However, the returned errors are valuable for debugging and usually indicate that developer’s attention is needed.

§Logging

The package uses the log crate for logging messages. Consider integrating a log-compatible logger implementation for better visibility into SDK operations.

§Examples

Examples can be found in the examples directory of the eppo crate repository.

Structs§

AllocationEvaluationDetails
AssignmentEvent
Represents an event capturing the assignment of a feature flag to a subject and its logging details.
AttributeValue
Attribute of a subject or action.
CategoricalAttribute
Categorical attributes are attributes that have a finite set of values that are not directly comparable (i.e., enumeration).
Client
A client for Eppo API.
ClientConfig
Configuration for Client.
ConditionEvaluationDetails
EvaluationDetails
Details about feature flag or bandit evaluation.
EvaluationResultWithDetails
NumericAttribute
Numeric attributes are quantitative (e.g., real numbers) and define a scale.
PollerThread
A configuration poller thread.
RuleEvaluationDetails
ShardEvaluationDetails
SplitEvaluationDetails

Enums§

AllocationEvaluationCode
AssignmentValue
Enum representing values assigned to a subject as a result of feature flag evaluation.
BanditEvaluationCode
Error
Enum representing possible errors that can occur in the Eppo SDK.
EvaluationError
Enum representing possible errors that can occur during evaluation.
FlagEvaluationCode

Traits§

AssignmentLogger
A trait for logging assignment events to your storage system. Implementations should handle persisting assignment events for analytics and tracking purposes.

Type Aliases§

Attributes
Type alias for a HashMap representing key-value pairs of attributes.
Result
Represents a result type for operations in the Eppo SDK.