---
title: Server-Side Feature Flags
description: Set up Datadog Feature Flags for server-side applications.
breadcrumbs: Docs > Feature Flags > Server-Side Feature Flags
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Server-Side Feature Flags

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Datadog Feature Flags server SDKs use agentless delivery: they receive flag configuration directly from the Datadog-managed CDN and evaluate flags locally. Agentless delivery does not require a Datadog Agent.

The SDKs implement the [OpenFeature standard](https://openfeature.dev/docs/reference/intro/). Register the Datadog provider with OpenFeature to use its evaluation API.

## Getting started{% #getting-started %}

Choose a language for the minimum installation, configuration, and evaluation example:

- [dotnet](https://docs.datadoghq.com/feature_flags/server/dotnet.md)
- [go](https://docs.datadoghq.com/feature_flags/server/go.md)
- [java](https://docs.datadoghq.com/feature_flags/server/java.md)
- [nodejs](https://docs.datadoghq.com/feature_flags/server/nodejs.md)
- [php](https://docs.datadoghq.com/feature_flags/server/php.md)
- [python](https://docs.datadoghq.com/feature_flags/server/python.md)
- [ruby](https://docs.datadoghq.com/feature_flags/server/ruby.md)

Use the following SDK versions or later. These are the baselines for the language guides and shared instructions.

| SDK                                                | Minimum version for this guide |
| -------------------------------------------------- | ------------------------------ |
| Java `dd-openfeature`                              | 1.69.0                         |
| Node.js `dd-trace`                                 | 6.24.0                         |
| Python `ddtrace`                                   | 4.17.0                         |
| .NET tracer and `Datadog.FeatureFlags.OpenFeature` | 3.57.0 and 2.3.2               |
| Ruby `datadog`                                     | 2.49.0                         |
| Go `dd-trace-go`                                   | 2.12.0                         |
| PHP `datadog/dd-trace`                             | 1.28.0                         |

Create a flag with the **Server** distribution channel enabled. Configure a Datadog [API key](https://docs.datadoghq.com/account_management/api-app-keys.md#api-keys) and the flag environment in the application process:

```bash
export DD_API_KEY='<DATADOG_API_KEY>'
export DD_ENV='<YOUR_ENVIRONMENT>'
```

If your organization uses a site other than `datadoghq.com`, set `DD_SITE`. For the selected site, use <YOUR_DATADOG_SITE>.

Then initialize the provider and evaluate the flag as shown on the language page. No Feature Flags enablement or source setting is required for new setups, except PHP:

```bash
# PHP requires explicit source selection before startup.
export DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=agentless
```

Java uses the standalone `dd-openfeature` dependency. .NET still requires the tracer to be loaded with automatic instrumentation. PHP still requires the native extension. See each language guide for runtime requirements.

`DD_SERVICE` and `DD_VERSION` are optional attribution settings. Metrics, tracing, and custom polling settings are not required to receive flags.

## Collect traces with flag evaluations{% #collect-traces-with-flag-evaluations %}

Use this optional setup to inspect request errors and latency by flag variant. Configure APM tracing, then enable [APM trace enrichment](https://docs.datadoghq.com/feature_flags/guide/apm_trace_enrichment.md) for a supported SDK. The SDK attaches flag evaluation data to the active request trace.

For Java, load `dd-java-agent` 1.69.0 or later to collect traces and attach flag evaluations. See [Collect traces with flag evaluations in Java](https://docs.datadoghq.com/feature_flags/server/java.md#collect-traces-with-flag-evaluations). Keep the application's existing flag configuration source when adding tracing.

To add only Feature Flags to an existing OpenTelemetry setup, use [Option B: Run the Datadog SDK alongside OpenTelemetry](https://docs.datadoghq.com/feature_flags/implementation_patterns/opentelemetry.md#option-b-run-the-datadog-sdk-alongside-opentelemetry). This keeps the existing tracing provider and exporter.

## Optional telemetry{% #optional-telemetry %}

Configuration delivery, event delivery, metrics, and APM tracing use separate paths:

- [Send feature flag telemetry](https://docs.datadoghq.com/feature_flags/implementation_patterns/serverless.md#send-feature-flag-telemetry): experiment exposures and aggregated flag evaluation events, with supported direct delivery or a local relay.
- [Server-side evaluation events and privacy](https://docs.datadoghq.com/feature_flags/guide/server_evaluation_events.md): evaluation-event collection controls, targeting-key hashing, and direct-delivery limits.
- [Server-side flag evaluation metrics](https://docs.datadoghq.com/feature_flags/guide/server_flag_evaluation_metrics.md): the separate `feature_flag.evaluations` OTLP metric.
- [APM trace enrichment](https://docs.datadoghq.com/feature_flags/guide/apm_trace_enrichment.md): flag evaluation data attached to APM traces.

Set `DD_FEATURE_FLAGS_ENABLED=false` to disable Feature Flags. See [Activation and billing](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md#activation-and-billing) for when delivery starts.

## Migrate from Agent delivery{% #migrate-from-agent-delivery %}

An existing deployment can remain on Agent delivery because of legacy enablement settings. Follow [Migrate an existing Remote Configuration setup](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md#migrate-an-existing-remote-configuration-setup) to move credentials into the application, select agentless delivery, and verify updates.

## Use Agent delivery{% #use-agent-delivery %}

To keep Agent delivery, configure Datadog Agent 7.55 or later with [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) enabled and an API key. Set this variable in the application:

```bash
export DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config
```

For Java, also load `dd-java-agent` 1.69.0 or later with `-javaagent`. Use `dd-openfeature` 1.69.0 or later. See the [Java Remote Configuration setup](https://docs.datadoghq.com/feature_flags/server/java.md#use-agent-delivery).

See [Server SDK Configuration Sources](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md) for Agent requirements, source precedence, and delivery settings.

## Testing with in-memory providers{% #testing-with-in-memory-providers %}

Datadog supports these testing approaches:

- **Integration tests**: Point `DatadogProvider` at a dedicated test environment and control flag values from the Datadog UI. This exercises the real provider and selected configuration source end-to-end.
- **Unit tests**: Swap `DatadogProvider` for OpenFeature's standard `InMemoryProvider` (or an equivalent test stub, where no in-memory provider is available in the language) and set flag values directly in test code. This keeps tests hermetic and offline.

This section covers the in-memory approach. Because the OpenFeature API is designed to make providers swappable at runtime, your application code does not change — only the provider registered during test setup.

A typical test follows this pattern:

1. Build a map of flag keys to variants in your test setup.
1. Register an `InMemoryProvider` with that map through the OpenFeature API.
1. Call the OpenFeature client in the units being tested. The `InMemoryProvider` returns the flag assignments configured at test setup.
1. Reset the provider in test teardown to avoid cross-test state leakage.

See your language's SDK page (select from the top of this page) for a concrete test example.

## Context attribute requirements{% #context-attribute-requirements %}

{% alert level="warning" %}
Evaluation context attributes must be flat primitive values (strings, numbers, booleans). Nested objects and arrays are **not supported** and will cause exposure events to be silently dropped.
{% /alert %}

Use flat attributes in your evaluation context:

```javascript
const evaluationContext = {
  targetingKey: req.session?.userID,
  companyId: req.session?.companyID,
  tier: 'enterprise'
};

const value = client.getBooleanValue('my-flag', false, evaluationContext);
```

Avoid nested objects and arrays:

```javascript
// These attributes will cause exposure events to be dropped
const evaluationContext = {
  targetingKey: req.session?.userID,
  company: { id: req.session?.companyID },  // nested object - NOT SUPPORTED
  roles: ['admin', 'user']                   // array - NOT SUPPORTED
};
```

## Opt out individual subjects{% #opt-out-individual-subjects %}

Configure evaluation telemetry and experiment participation independently for each subject. Support and release requirements differ by SDK. See [Flag Evaluation and Experimentation Opt-Out](https://docs.datadoghq.com/feature_flags/concepts/opt_out.md) for the support matrix, mode behavior, and language-specific examples.

Supply preferences in each evaluation's context. Do not change a shared global context for individual server requests.

## Further reading{% #further-reading %}

For percentage-based rollouts and deterministic bucketing, see [Traffic Splitting and Randomization](https://docs.datadoghq.com/feature_flags/concepts/traffic_splitting.md).

Additional helpful documentation, links, and articles:

- [Client-Side Feature Flags](https://docs.datadoghq.com/feature_flags/client.md)
- [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md)
- [Set Up Server-Side Flag Evaluation Metrics](https://docs.datadoghq.com/feature_flags/guide/server_flag_evaluation_metrics.md)
- [Feature Flag Graphs](https://docs.datadoghq.com/feature_flags/concepts/flag_graphs.md)
- [Serverless environments and Feature Flags](https://docs.datadoghq.com/feature_flags/implementation_patterns/serverless.md)
- [Server SDK Configuration Sources](https://docs.datadoghq.com/feature_flags/concepts/configuration_sources.md)
- [Set Up APM Trace Enrichment for Feature Flags](https://docs.datadoghq.com/feature_flags/guide/apm_trace_enrichment.md)
