Split Evaluator
Using Harness FME involves using one of our SDKs. The FME team builds and maintains these SDKs for some of the most popular language libraries and the SDKs are available under open source licenses. For languages where there is no native SDK support, Harness offers the Split Evaluator, a small service capable of evaluating some or all available features for a given customer via a REST endpoint.
While tools like Postman can be used to make HTTP calls to download feature flag definitions from Harness FME servers, they cannot replace the SDK libraries for calculating treatments. This is because the SDKs perform a local evaluation that includes computing a Murmur hash to assign a bucket (from 1 to 100) for a given user ID, and then apply the feature flag rules and conditions based on that bucket. This evaluation process is not performed by the Harness FME servers, which means direct HTTP calls alone are insufficient for treatment calculation.
As a workaround, the Split Evaluator can be installed in your environment, allowing tools like Postman to make HTTP GET requests to fetch treatments for a given feature flag and user ID. The Split Evaluator performs the treatment calculation and responds with the corresponding treatment.
Setup
The service is available via Docker or command line and its source code is available at https://github.com/splitio/split-evaluator.
Docker (recommended)
Pull the image:
docker pull splitsoftware/split-evaluatorRun as:
docker run \
-e SPLIT_EVALUATOR_API_KEY={YOUR_SDK_KEY} \
-p 7548:7548 splitsoftware/split-evaluatorCommand line
To install the service via command line:
Clone the repository:
git clone https://github.com/splitio/split-evaluatorPrepare the sources:
npm install
Endpoints
The following section will describe the APIs that evaluator can manage. There are grouped in four different resources depending on what they want to achieve.
Client: it corresponds to the APIs used to get treatments (which send impressions) and track events.
Manager: it corresponds to the APIs that will give you information of the available feature flags.
Admin: it corresponds to the APIs that will give you information of the Split Evaluator itself.
api-docs: it will contain the Swagger specification of Split Evaluator.
api-docs
Swagger
Split Evaluator uses Swagger to document all API endpoints available in this service. They are available by default in this url: http://localhost:7548/api-docs. If the port has been modified from the default(7548), make sure to set the environment variable SPLIT_EVALUATOR_SWAGGER_URL to match it.
Client APIs
Corresponds to the Client APIs that is evaluating treatments, generating impressions and tracking events.
get-treatment
get-treatments
get-treatments-by-sets
get-treatment-with-config
get-treatments-with-config
get-treatments-with-config-by-sets
get-all-treatments
get-all-treatments-with-config
track
All evaluation examples below show impressions disabled for demonstration purposes.
Attributes
The evaluator runs on the JavaScript SDK, so it supports all attributes available in the SDK.
Disabling impressions per evaluation
By default, all evaluation endpoints generate impressions for each feature flag evaluation. Apart from using the impressions mode in evaluator config or turning impressions off at the flag level, you can disable impression logging on a per-request basis using the impressionsDisabled evaluation option. Disabling impressions does not affect treatment assignment or configuration payloads; it only prevents impression events from being generated for that evaluation while still tracking flag related traffic.
You can use the impressions-disabled query parameter in GET requests.
For example:
You can set impressionsDisabled in the request body of POST requests.
For example:
/client/get-treatment
Evaluates a single feature flag for a single key.
Query params
key: The key used in the
getTreatmentcall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.split-name: The name of the feature flag you want to include in the
getTreatmentcall.bucketing-key: (Optional) The bucketing key used in the
getTreatmentcall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentcall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-treatments
Provides a way of doing multiple evaluations at once.
Query params
key: The key used in the
getTreatmentscall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.split-names: The names of the feature flags you want to include in the
getTreatmentscall separated by commas.bucketing-key: (Optional) The bucketing key used in the
getTreatmentscall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentscall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-treatments-by-sets
Evaluates all flags that are part of the provided set names and are cached on the SDK instance.
Query params
key: The key used in the
getTreatmentsBySetscall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.flag-sets: The names of the flag sets you want to include in the
getTreatmentsBySetscall separated by commas.bucketing-key: (Optional) The bucketing key used in the
getTreatmentsBySetscall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentsBySetscall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-treatment-with-config
Evaluates a single feature flag for a single key and adds config in the result.
Query params
key: The key used in the
getTreatmentWithConfigcall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.split-name: The name of the feature flag you want to include in the
getTreatmentWithConfigcall.bucketing-key: (Optional) The bucketing key used in the
getTreatmentWithConfigcall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentWithConfigcall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-treatments-with-config
Provides a way of doing multiple evaluations at once and attaches configs for each feature flag evaluated.
Query params
key: The key used in the
getTreatmentsWithConfigcall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.split-names: The names of the feature flags you want to include in the
getTreatmentsWithConfigcall separated by commas.bucketing-key: (Optional) The bucketing key used in the
getTreatmentsWithConfigcall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentsWithConfigcall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-treatments-with-config-by-sets
Provides a way of doing multiple evaluations at once and attaches configs for each feature flag that are part of the provided set names.
Query params
key: The key used in the
getTreatmentsWithConfigBySetscall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.flag-sets: The names of the flag sets you want to include in the
getTreatmentsWithConfigBySetscall separated by commas.bucketing-key: (Optional) The bucketing key used in the
getTreatmentsWithConfigBySetscall.attributes: (Optional) A JSON string of the attributes to include in the
getTreatmentsWithConfigBySetscall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-all-treatments
Performs multiple evaluations at once. In this case it will match all the feature flags for a given traffic-type and will perform a getTreatments call with the key provided. You can send more than one {matchingKey,bucketingKey,trafficType} object.
Query params
keys: The array of keys to be used in the
getTreatmentscall. Each key should specifymatchingKeyandtrafficType. You can also optionally specifybucketingKey.attributes: (optional) A JSON string of the attributes to include in the
getTreatmentscall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/get-all-treatments-with-config
Performs multiple evaluations at once. In this case it will match all the feature flags for a given traffic-type and will perform a getTreatmentsWithConfig call with the key provided. You can send more than one {matchingKey,bucketingKey,trafficType} object. This endpoint will also adds the configurations for particular feature flag.
Query params
keys: The array of keys to be used in the
getTreatmentsWithConfigcall. Each key should specifymatchingKeyandtrafficType. You can also optionally specifybucketingKey.attributes: (optional) A JSON string of the attributes to include in the
getTreatmentsWithConfigcall of the SDK.properties: (Optional) A JSON string of the properties to include in the evaluation. Must be a flat object with up to 15 keys for GET requests. Values must be boolean, string, number, or null.
impressions-disabled: (Optional) When set to
true, disables impression logging for this evaluation request.
Example:
Response:
/client/track
Records any actions your customers perform. Each action is known as an event and corresponds to an event type. Calling track allows you to measure the impact of your feature flags on your users' actions and metrics.
Query params
key: The key used in the
trackcall. Each key should specifymatchingKey. You can also optionally specifybucketingKey.traffic-type: The traffic type of the key that you want to include in the
trackcall.event-type: The event type that this event should correspond to the
trackcall of the SDK.value: (Optional) value to be used in creating the metric.
properties: (Optional) A JSON string of the properties to include in the
trackcall of the SDK for filtering your metrics.
Example:
Response: Successfully queued event
Manager APIs
Provides information of all the available feature flags.
split
splits
names
/manager/split
Provides information of one particular feature flag.
Query params
split-name: The name of the feature flag you want to have information. It uses
splitcall of the SDK.
Example:
Response:
/manager/splits
Provides information of all the available feature flags by calling splits method from the SDK.
Example:
Response:
/manager/names
Provides the names of the available feature flags. It calls names of the SDK.
Example:
Response:
Admin
Provides information about Split Evaluator itself.
ping
uptime
healthcheck
version
machine
stats
/admin/ping
A ping endpoint to monitor the service status. If the service is running, it responds with pong and the HTTP status code 200.
Example:
/admin/uptime
Returns the uptime of the service in a human-readable string.
Example:
Response:
/admin/healthcheck
Checks that everything is working as expected before sending evaluations. It returns a status code of either 200 or 500, depending on the result of the check, along with a message explaining the status.
Example:
Response:
/admin/version
Version information for the evaluator and the SDK within.
Example:
Response:
/admin/machine
Returns the data for the machine where this service is running.
Example:
Response:
/admin/stats
Returns information about evaluator like uptime and versions and the following stats from every environment:
splitCount: Number of feature flags.
segmentCount: Number of segments.
lastSynchronization:
splits: timestamp for last feature flags synchronization.
segments: timestamp for last segments synchronization.
impressions: timestamp for last impressions synchronization.
impressionCount: timestamp for last impressionCount synchronization.
events: timestamp for last events synchronization.
telemetry: timestamp for last telemetry synchronization.
token: timestamp for last token synchronization.
timeUntilReady: time elapsed until environment reached ready state.
httpErrors: information about http errors.
ready: environment readiness status.
impressionsMode: environment impressions mode.
Example:
Response:
Impression listener
The Split Evaluator provides an impression listener (SPLIT_EVALUATOR_IMPRESSION_LISTENER_ENDPOINT) that bulks post impressions to a user-defined HTTP endpoint. The endpoint should expect a POST request, containing a JSON body with the following format.
If an impression listener is provided when the Split Evaluator is initialized, a task runs in background that posts impressions. There are two ways of posting impressions to the provided endpoint:
Every 30 seconds by the Evaluator.
When the queue of impressions reached the max amount of impressions.
For more information about how to configure the impression listener, refer to Configuration section of this guide.
Multiple environments support
Split Evaluator allows you to set more than one environment. This means that it's possible to evaluate treatments for many SDK keys. To use this feature, the evaluator requires that each SDK key is paired with a custom authorization token (which can be any string) in the environment variable SPLIT_EVALUATOR_ENVIRONMENTS as is shown in the following example:
The previous command line example initializes the Split Evaluator connected to two environments. To evaluate or retrieve flags on env1 using {SDK_KEY_env1}, the requests should be done with {CUSTOM_AUTHENTICATION_1} set as the Authorization header.
Example:
/manager/splits (For environment 1)
This provides information of all the available feature flags by calling the splits method from the SDK initialized with <YOUR_SDK_KEY_1>.
Example:
/manager/splits (For environment 2)
This provides information of all the available feature flags by calling the splits method from the SDK initialized with <YOUR_SDK_KEY_2>.
Example:
Global config
The SDK exposes configuration parameters that you can use to optimize SDK performance. Each parameter is preset to a reasonable default. You can optionally override these default values when instantiating the SDK.
Configuration
Description
Default value
scheduler.featuresRefreshRate
The SDK polls Harness servers for changes to feature rollout plans. This parameter controls this polling period in seconds.
60
scheduler.segmentsRefreshRate
The SDK polls Harness servers for changes to segment definitions. This parameter controls this polling period in seconds.
60
scheduler.impressionsRefreshRate
The SDK sends information on who got what treatment at what time back to Harness servers to power analytics. This parameter controls how often this data is sent to Harness servers. The parameter is in seconds.
300
scheduler.impressionsQueueSize
The max amount of impressions we queue. If the queue is full, the SDK flushes the impressions and resets the timer.
30000
scheduler.eventsPushRate
The SDK sends tracked events to Harness servers. This setting controls that flushing rate in seconds.
60
scheduler.eventsQueueSize
The max amount of events we queue. If the queue is full, the SDK flushes the events and resets the timer.
500
scheduler.telemetryRefreshRate
The SDK caches diagnostic data that it periodically sends to Harness servers. This configuration controls how frequently this data is sent back to Harness servers in seconds.
3600 seconds (1 hour)
startup.requestTimeoutBeforeReady
Time to wait for a request before the SDK is ready. If this time expires, Node.js SDK tries again retriesOnFailureBeforeReady times before notifying its failure to be ready. Zero means no timeout.
15
startup.retriesOnFailureBeforeReady
Number of quick retries we do while starting up the SDK.
1
startup.readyTimeout
Maximum amount of time in seconds to wait before notifying a timeout. Zero means no timeout, so no SDK_READY_TIMED_OUT event is fired.
15
sync.splitFilters
Filter specific feature flags to be synced and evaluated by the SDK. This is formed by a type string property and a list of string values for the given criteria. Using the types 'bySet' (recommended, flag sets are available in all tiers) or 'byName', pass an array of strings defining the query. If empty or unset, all feature flags are downloaded by the SDK.
[]
sync.impressionsMode
This configuration defines how impressions (decisioning events) are queued on the SDK. Supported modes are OPTIMIZED, NONE, and DEBUG. In OPTIMIZED mode, only unique impressions are queued and posted to Harness. This is the recommended mode for experimentation use cases. In NONE mode, no impression is tracked in Harness FME and only minimum viable data to support usage stats is, so never use this mode if you are experimenting with that instance impressions. Use NONE when you want to optimize for feature flagging only use cases and reduce impressions network and storage load. In DEBUG mode, ALL impressions are queued and sent to Harness; this is useful for validations. This mode doesn't impact the impression listener which receives all generated impressions locally.
OPTIMIZED
debug
Boolean flag or log level string ('ERROR', 'WARN', 'INFO', or 'DEBUG') for activating SDK logs.
false
streamingEnabled
Boolean flag to enable the streaming service as default synchronization mechanism. In the event of an issue with streaming, the SDK falls back to the polling mechanism. If false, the SDK polls for changes as usual without attempting to use streaming.
true
To set each of the parameters defined above, use the following syntax:
Example:
Configuration
The available configuration variables are listed below. Always use -e <VARIABLE>=<VALUE> with Docker.
Variable
Description
Default
SPLIT_EVALUATOR_ENVIRONMENTS
String list of environments "API_KEY":string, "AUTH_TOKEN":string}[]
-
SPLIT_EVALUATOR_API_KEY
SDK key to authenticate against Harness FME services.
-
SPLIT_EVALUATOR_AUTH_TOKEN
Authentication key used to authenticate every request via the Authorization header. This is not a SDK key but an arbitrary value defined by the user.
No authentication
SPLIT_EVALUATOR_GLOBAL_CONFIG
String SDK config for every environment.
-
SPLIT_EVALUATOR_LOG_LEVEL
Use for setting the log level for service (NONE
INFO
SPLIT_EVALUATOR_SERVER_PORT
TCP port of the server inside the container. When using in Docker, make sure to match the right side of -p <ext_port>:<internal_port> with the value of this variable.
7548
SPLIT_EVALUATOR_IMPRESSION_LISTENER_ENDPOINT
Use it for providing a webhook to send a bulk of Impressions
-
SPLIT_EVALUATOR_SPLITS_REFRESH_RATE
The SDK polls Harness servers for changes to feature roll-out plans. This parameter controls this polling period in seconds.
60
SPLIT_EVALUATOR_SEGMENTS_REFRESH_RATE
The SDK polls Harness servers for changes to segment definitions. This parameter controls this polling period in seconds.
60
SPLIT_EVALUATOR_METRICS_POST_RATE
The SDK sends diagnostic metrics to Harness servers. This parameters controls this metric flush period in seconds.
60
SPLIT_EVALUATOR_IMPRESSIONS_POST_RATE
The SDK sends information on who got what treatment at what time back to Harness servers to power analytics. This parameter controls how often this data is sent to Harness servers. The parameter should be in seconds.
60
SPLIT_EVALUATOR_EVENTS_POST_RATE
The SDK sends tracked events to Harness servers. This setting controls that flushing rate in seconds.
60
SPLIT_EVALUATOR_EVENTS_QUEUE_SIZE
The max amount of events we queue. If the queue is full, the SDK flushes the events and reset the timer.
500
SPLIT_EVALUATOR_SWAGGER_URL
The url used as base for any Swagger test curl commands.
http://localhost:7548
SPLIT_EVALUATOR_IP_ADDRESSES_ENABLED
Flag to disable IP addresses and host name from being sent to the Harness servers.
'true'
HTTPS/SSL
This service does not currently support a secured connection. We recommend running this service in a redundant manner behind a load balancer such as AWS ELB or Nginx, with SSL termination.
Contact support@split.io if you have questions.
Last updated
Was this helpful?