No results for ""
EXPAND ALL
  • Home
  • API docs

The Contexts list

Read time: 5 minutes
Last edited: Dec 04, 2024

Overview

This topic explains what the Contexts list is, how it is populated, and how to use it.

The Contexts list shows you contexts that have encountered feature flags in your application, with two exceptions:

  • The list does not display anonymous contexts.
  • In high-volume environments, the list includes a significant sample of the contexts, but is not comprehensive. To learn more, read Context storage, below.

You can select any context to view its context detail page, which gives you a summary view of how the context experiences all of the features in your app, and lets you customize their experience from one screen. To learn more, read The context details page.

About the Contexts list

The Contexts list populates automatically when different contexts encounter a feature flag and are evaluated by a LaunchDarkly SDK. The data in the list is populated from the data you send in variation calls, as well as data from identify calls. To learn more about contexts and attributes, read Context attributes.

Try it in your SDK: Evaluating flags

Here is an image of the Contexts list:

The "Contexts" list.
The "Contexts" list.
Multi-contexts appear individually in the Contexts list

Your application may evaluate a feature flag for a multi-context, that is, one that contains multiple context kinds. For example, your application may send a multi-context that contains the "user," "organization," and "device" context kinds, all in one evaluation call in the LaunchDarkly SDK. When you do this, all three individual contexts appear separately in your Contexts list. You can use the context kind filters to search for them separately.

From the list, you can filter contexts by name, kind, or attribute. To learn how, read Filtering the Contexts list.

Create contexts

You cannot create contexts from the Contexts list in the LaunchDarkly user interface (UI). The list only includes contexts that have already been evaluated by a LaunchDarkly SDK.

Configure your SDK: Context configuration

Send the context name in the variation call

You must send the context name in the variation call in the LaunchDarkly SDK for the name to display in the LaunchDarkly UI. To learn more, read Context attributes.

To learn how to create context kinds, read Create context kinds.

Sort the Contexts list

You can sort the Contexts list to identify the oldest or most recent contexts evaluated in your LaunchDarkly account. By default, the most recently active contexts appear first. Click the toggle arrow on the "Last seen" column to sort the list by least recently active contexts.

If a context is re-evaluated, and its attributes change within five minutes of the previous evaluation, and the context key stays the same, the list deduplicates the context and does not reflect the latest evaluation. This does not affect variation calls, which always use the attribute values passed to them.

The SDK does not use the attributes on the Contexts list to evaluate flags

The SDK only evaluates flags based on the context you provide in the evaluation call. The SDK does not use the attributes shown on the Contexts list, and context attributes are not synchronized across SDK instances. You must provide all applicable attributes for each evaluation in the SDK for your targeting rules to apply correctly. To learn more, read Evaluating flags.

You can also use the REST API: Get contexts, Get context instances

To learn how to retrieve expected flag variations for contexts programmatically, read How to use REST API to fetch variations served by a flag.

Customize the Contexts list

You can customize which attributes appear on the Contexts list. To start, click the Attributes button:

The "Attributes" menu on the "Contexts" list.
The "Attributes" menu on the "Contexts" list.

The Attributes menu lets you choose attributes to appear on the Contexts list. After you choose specific attributes, that view persists when you visit the list in the future.

You can also filter the context list and save filtered lists. To learn how, read Filtering the Contexts list.

Modify feature flags for a context instance

Click a context to manage the feature flags that apply to it, view the context instances that have encountered your flags, view the segments that the context is in, and view a full list of context attributes. To learn more, read The context details page.

Context storage

The Contexts list shows only cached context information. A context will appear on the list for 30 days after an SDK sends an identify event or evaluates a feature flag for that context. Each time an SDK sends a new event for the context, the 30-day period starts over.

After 30 days with no new identify or flag evaluation events, contexts age out of the system and their information no longer appears on the list. After a context ages out of the system, it will reappear on the list if an SDK sends an identify or flag evaluation event for it again.

If you want to keep contexts on the list for longer than 30 days between flags sending identify or flag evaluation events, you can manually call identify for all of the contexts that you wish to retain.

In high-volume environments, events may be sampled. This means the Contexts list includes a significant sample of the contexts that have encountered feature flags in your application, but is not comprehensive.

Each environment in your account is limited to 3,000,000 context instances for a given 30-day period. If you reach this context instance limit, flag evaluations will still work for new contexts. However, LaunchDarkly will begin deleting the oldest context instances on the list to make room for new context instances, even if they are not yet more than 30 days old. LaunchDarkly continues to delete old context instances as new ones are added to keep the list at no more than 3,000,000.

To learn more about how you might exceed the 3,000,000 context limit when using anonymous contexts, read Context account limits.

If you want to increase this limit, start a Support ticket.

Remove a context instance

You can delete individual context instances from the Contexts list by clicking the overflow menu and choosing "Delete instance." Deleting a context instance deletes all versions of that instance.

The overflow menu only appears if there is exactly one context instance, due to the risks of deleting multiple instances at once.

You can also delete context instances from the context details page. To learn how, read Delete context instances.

To learn more about context instances, read Context instances.

You can also use the REST API: Delete context instances