Serverless Environments

Ce produit n'est pas pris en charge par le site Datadog que vous avez sélectionné. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Overview

The Datadog Feature Flags Java and Node.js SDKs can receive flag configuration directly from the Datadog-managed CDN. This agentless configuration source simplifies onboarding because it does not require a Datadog Agent for flag configuration. It also supports serverless applications that cannot connect to a Datadog Agent.

After configuration is loaded, flag evaluation happens locally in the application. The SDK does not make a network request for each evaluation.

Agentless configuration delivery is available in:

SDKMinimum version
Java dd-openfeature and dd-java-agent1.65.0
Node.js dd-trace v55.116.0
Node.js dd-trace v66.5.0

Java CDN delivery requires dd-openfeature and dd-java-agent. The Java runtime must support loading dd-java-agent with the -javaagent JVM option. You can pass this option in the Java command or through JAVA_TOOL_OPTIONS.

Other server SDKs and versions earlier than those listed require Agent Remote Configuration for flag delivery.

The initial Node.js agentless releases load configuration and evaluate flags locally. They do not export evaluation metrics or exposure events. Java agentless delivery changes only the configuration source. Without a supported Datadog Agent or serverless telemetry path, Java also does not export these signals.

Agentless architecture

Use agentless delivery when the serverless runtime can make outbound HTTPS requests to Datadog. For Java, the runtime must also let you set the -javaagent JVM option:

  1. Use a supported SDK version.

  2. For Java, load dd-java-agent with -javaagent or JAVA_TOOL_OPTIONS. See the Java setup for Cloud Run Functions or Cloud Run containers for examples.

  3. Configure the API key, Datadog site, and environment in the serverless application:

       DD_API_KEY=<DATADOG_API_KEY>
       DD_SITE=<code class="js-region-param region-param" data-region-param="dd_site"></code>
       DD_ENV=<YOUR_ENVIRONMENT>
  4. Initialize or access the Datadog OpenFeature provider as described in the Java or Node.js setup. This starts CDN polling. No Feature Flags enablement or source setting is required.

  5. Store DD_API_KEY in the serverless platform’s secret manager and expose it only to the application process.

The SDK polls the Datadog-managed CDN every 30 seconds by default and uses ETags for unchanged configuration. It preserves the last accepted configuration during temporary errors. If no configuration has been accepted, OpenFeature evaluations return the caller-provided default value.

Tracer installation and initialization alone do not start CDN polling. Requests to the CDN contribute to server Feature Flags billing only after application code activates the provider.

Agentless mode removes the Datadog Agent dependency for flag configuration. It does not remove language-specific tracer requirements. It also does not configure or enable APM and serverless telemetry. You can use the Datadog Lambda Extension, serverless-init, an Agent sidecar, or another supported telemetry path independently.

Agent-backed Remote Configuration

Set DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config to explicitly use the existing Agent Remote Configuration path:

# Serverless application
DD_FEATURE_FLAGS_CONFIGURATION_SOURCE=remote_config
DD_AGENT_HOST=<PRIVATE_AGENT_HOSTNAME_OR_IP>
DD_TRACE_AGENT_PORT=8126

For Java, use compatible dd-openfeature and dd-java-agent versions. Use version 1.65.0 or later for both components.

Configure the Agent with Remote Configuration and the API key:

DD_REMOTE_CONFIGURATION_ENABLED=true
DD_API_KEY=<DATADOG_API_KEY>
DD_SITE=<DATADOG_SITE>

The serverless workload must be able to reach the Agent on a private network, and the Agent must be able to reach Datadog over HTTPS. Do not expose the Agent trace intake publicly.

Explicitly selecting remote_config enables the Feature Flags Remote Configuration subscription, even if application code does not initialize the provider. These requests contribute to server Feature Flags billing.

Operational considerations

  • Cold starts: Blocking provider initialization waits for the first configuration and can add cold-start latency. Initialize asynchronously if serving caller-provided default values during startup is acceptable.
  • Outbound connectivity: Agentless delivery requires outbound HTTPS access to the Datadog-managed flag configuration service.
  • API key ownership: In agentless mode, the application owns DD_API_KEY. In remote_config mode, the Agent owns the API key.
  • Flag updates: Delivery is eventually consistent. Allow for the SDK polling interval and application startup time when testing changes.
  • Last-known-good behavior: After a configuration has been accepted, temporary network failures or malformed responses do not replace it.
  • Runtime support: Java requires Java 11 or later. For Node.js, check the tracer’s runtime compatibility requirements.
  • Kill switch: DD_FEATURE_FLAGS_ENABLED defaults to true. Set it to false to disable the provider and both configuration delivery paths. Evaluations then return caller-provided default values.

Datadog-managed agentless delivery is not available for Datadog for Government in these versions. Use Agent Remote Configuration on that site.

If your deployment uses DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED, see Migrate from the legacy provider setting.

Environment notes

AWS Lambda

Java and Node.js Lambda functions can use agentless configuration delivery when they run a minimum SDK version and can reach Datadog over HTTPS. Java functions must load dd-java-agent with -javaagent, either directly or through JAVA_TOOL_OPTIONS. A Java tracing layer can provide this setup. The Datadog Lambda Extension is not required for flag configuration.

Google Cloud serverless environments

Java workloads can use agentless configuration delivery on Java 11 or later when the runtime can load dd-java-agent. The Java setup for Cloud Run Functions and Cloud Run containers uses JAVA_TOOL_OPTIONS to set -javaagent. Node.js workloads require a supported tracer runtime. Both runtimes require outbound HTTPS access.

Azure Functions

Java function apps can use agentless configuration delivery on Java 11 or later when the runtime can load dd-java-agent. Node.js function apps require a supported tracer runtime. Both runtimes require outbound HTTPS access. An external Datadog Agent is only required when remote_config is selected.

Edge runtimes

Some edge runtimes do not support the Datadog Node.js tracer APIs required by the Feature Flags provider. Verify tracer compatibility for the target platform before relying on agentless configuration delivery.

Public API and local evaluation

The public Feature Flags API is intended for managing flags and environments. It is not a per-request flag evaluation API for server-side applications.

Do not query Datadog APIs from each serverless invocation to evaluate flags. Use the server SDK, which periodically loads flag configuration and evaluates locally.

Validate your setup

Before enabling Feature Flags in production:

  1. Confirm the application uses a minimum supported SDK version. For Java, confirm that the JVM loads dd-java-agent.
  2. For agentless delivery, confirm the application has DD_API_KEY, DD_SITE, and DD_ENV. For Agent Remote Configuration, confirm the Agent has its API key and Remote Configuration enabled.
  3. Initialize the OpenFeature provider and check that it reaches a ready state.
  4. Change a non-production flag in Datadog and confirm that the workload receives the updated value after the polling interval.
  5. Confirm that your application handles caller-provided defaults if configuration is unavailable during a cold start.
  6. For Node.js, do not plan experimentation workflows around evaluation metrics or exposure data. For Java, configure a supported Datadog Agent or serverless telemetry path before you use these signals.

Further reading