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

# 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). ().
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Datadog Feature Flags for server-side applications allow you to remotely control feature availability, run experiments, and roll out new functionality with confidence. Server-side SDKs integrate with the Datadog SDK and use Remote Configuration to receive flag updates in real time.

This guide covers the common setup required for all server-side SDKs, including Agent configuration and application environment variables. Select your language or framework to view SDK-specific setup instructions:

- [.NET](https://docs.datadoghq.com/feature_flags/server/dotnet/)
- [Go](https://docs.datadoghq.com/feature_flags/server/go/)
- [Java](https://docs.datadoghq.com/feature_flags/server/java/)
- [Node.js](https://docs.datadoghq.com/feature_flags/server/nodejs/)
- [Python](https://docs.datadoghq.com/feature_flags/server/python/)
- [Ruby](https://docs.datadoghq.com/feature_flags/server/ruby/)

## Prerequisites{% #prerequisites %}

Before setting up server-side feature flags, ensure you have:

- **Datadog Agent 7.55 or later** installed and running
- **Datadog [API key](https://docs.datadoghq.com/account_management/api-app-keys.md#api-keys)** configured
- **APM tracing** [enabled in your application](https://docs.datadoghq.com/tracing/guide.md#tutorials-enabling-tracing)
- **Remote Configuration** enabled for your organization. Verify this in [Organization Settings](https://app.datadoghq.com/organization-settings/remote-config).

## Agent configuration{% #agent-configuration %}

Server-side feature flags use [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md) to deliver flag configurations to your application. Enable Remote Configuration in your Datadog Agent by setting `DD_REMOTE_CONFIGURATION_ENABLED=true` or adding `remote_configuration.enabled: true` to your `datadog.yaml`.

See the [Remote Configuration documentation](https://docs.datadoghq.com/remote_configuration.md) for detailed setup instructions across different deployment environments.

### Polling interval{% #polling-interval %}

The Agent polls Datadog for configuration updates at a configurable interval. This interval determines the average time between making a flag change in the UI and the change becoming available to your application.

```bash
# Optional: Configure polling interval (default: 60s)
DD_REMOTE_CONFIGURATION_REFRESH_INTERVAL=10s
```

## Application configuration{% #application-configuration %}

Configure your application with the standard Datadog environment variables. These are common across all server-side SDKs:

```bash
# Required: Service identification
DD_SERVICE=<YOUR_SERVICE_NAME>
DD_ENV=<YOUR_ENVIRONMENT>
DD_VERSION=<YOUR_APP_VERSION>

# Agent connection (if not using default localhost:8126)
DD_AGENT_HOST=localhost
DD_TRACE_AGENT_PORT=8126

# Enable Remote Configuration in the SDK
DD_REMOTE_CONFIG_ENABLED=true

# Enable the feature flagging provider (required for most SDKs)
DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=true

# Enable flag evaluation metrics (required for flag evaluation tracking)
DD_METRICS_OTEL_ENABLED=true
```

{% alert level="warning" %}
The `DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=true` environment variable is required to enable the feature flagging provider. Java also supports the system property `-Ddd.experimental.flagging.provider.enabled=true`, and Ruby and Node.js support code-based configuration as an alternative. See the SDK-specific documentation for details.
{% /alert %}

{% alert level="info" %}
Set `DD_METRICS_OTEL_ENABLED=true` to enable flag evaluation metrics. Without this, the SDK does not emit metrics for flag evaluations. When enabled, each evaluation records a `feature_flag.evaluations` counter metric tagged with the flag key, result variant, and evaluation reason.
{% /alert %}

## 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 end-to-end, including Remote Configuration delivery.
- **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
};
```

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

- [Client-Side Feature Flags](https://docs.datadoghq.com/feature_flags/client.md)
- [Remote Configuration](https://docs.datadoghq.com/remote_configuration.md)
