diff --git a/website/docs/reference/playground.mdx b/website/docs/reference/playground.mdx index 8301621bfe..b173152504 100644 --- a/website/docs/reference/playground.mdx +++ b/website/docs/reference/playground.mdx @@ -1,10 +1,11 @@ --- title: The Playground --- +import Figure from '@site/src/components/Figure/Figure.tsx' :::info Availability -The Unleash playground is available from Unleash 4.14 onwards. The playground is available in all Unleash versions. +The Unleash playground is available in all Unleash versions from Unleash 4.14 onwards. Unleash 5.3 introduced a more advanced playground that allows you to query multiple environments and multiple values for a single context value at the same time. ::: @@ -22,11 +23,11 @@ Each feature toggle will contain info on whether it was enabled or not and which This section describes what information the playground needs to evaluate your Unleash context against your existing features. -### Environment and projects +### Environments and projects -The playground needs to know which environment and which projects to use when evaluating features. The playground UI will default to using the first environment in your list of instance environments and all projects. +The playground needs to know which environments and which projects to use when evaluating features. The playground UI will default to using the first environment in your list of instance environments and all projects. -Features can only be evaluated against a single environment at a time. The environment should be one of the environments configured for your Unleash instance. +You can select as many of your environments as you want. All environments must be environments that exist in your Unleash instance. Prior to Unleash 5.3, features could only be evaluated against a single environment at a time. The playground will only evaluate features belonging to the projects you specify. The projects parameter can either be a list of projects **or** _all_ projects. @@ -34,6 +35,18 @@ The playground will only evaluate features belonging to the projects you specify The [Unleash context](../reference/unleash-context.md) represents a client SDK's configuration and used for evaluating your features. You can construct your own context or use a JSON version of a context from a client. +#### Multiple values for a single context field + +:::info Availability + +The ability to specifiy multiple values for a single context field was introduced in Unleash 5.3. + +::: + +You can specify multiple values for a single context field by separating the values with a comma. For instance: `"value1, value2"`. + +When you specify multiple values for context field, each value will be used to populate one variant of the response. + #### Implicit context fields You can add any fields you want to the context used for the evaluation, and you can also leave out any fields you want. However, there are some fields that will be set for you if don't provide them: @@ -45,10 +58,25 @@ You can add any fields you want to the context used for the evaluation, and you ![Playground results: a table of feature names and whether they're enabled or not.](/img/playground-results.png) -The playground's response contains a list of all the feature toggles that have been evaluated based on your configured [environments and projects](#environments-and-projects). In the UI, the playground displays the features in a table. Each feature indicates whether its considered _enabled_ or _disabled_ and which [variant](../reference/feature-toggle-variants.md) was assigned to it, if any. +The playground's response contains a list of all the feature toggles that have been evaluated based on your configured [environments, projects](#environments-and-projects) and [context](#the-unleash-context). The full response will contain results for all combinations of context fields and all environments that you selected. + +In the UI, the playground displays the features in a table. Each row of the table corresponds to a single feature. The table has a separate column for each of the environments that you selected for your query. + +
+ +Because you can add multiple values for each context field, each feature-environment cell contains the number of combinations that evaluated to `true` and `false` for the feature in the given environment. This can be expanded into a more detailed overview over what combinations of context fields evaluated to `true` and `false` along with any [variants](../reference/feature-toggle-variants.md). + +
As with all of Unleash's client SDKs, the playground respects [stickiness](../reference/stickiness.md). The [stickiness algorithm](../reference/stickiness.md#calculation) guarantees that you'll always get the same variants and the same gradual rollout results if you provide the same context, as long as you provide the context field used for calculating stickiness. +### The diff view + +You can compare how a feature evaluates in different environments. If you select more than one environment for your playground query, the table will have an additional "Diff" column in each row. Using the "preview diff" button, you can open a table that gives an overview over how the feature evaluated for each context combination in each environment. + +
+ + ### Detailed evaluation results :::info Availability diff --git a/website/static/img/playground-results-development.png b/website/static/img/playground-results-development.png new file mode 100644 index 0000000000..20d36fd857 Binary files /dev/null and b/website/static/img/playground-results-development.png differ diff --git a/website/static/img/playground-results-diff.png b/website/static/img/playground-results-diff.png new file mode 100644 index 0000000000..8747ad3e05 Binary files /dev/null and b/website/static/img/playground-results-diff.png differ diff --git a/website/static/img/playground-results-row.png b/website/static/img/playground-results-row.png new file mode 100644 index 0000000000..22da96a5c0 Binary files /dev/null and b/website/static/img/playground-results-row.png differ