Datadog.FeatureFlags.OpenFeature 2.3.3

Prefix Reserved
dotnet add package Datadog.FeatureFlags.OpenFeature --version 2.3.3
                    
NuGet\Install-Package Datadog.FeatureFlags.OpenFeature -Version 2.3.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Datadog.FeatureFlags.OpenFeature" Version="2.3.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Datadog.FeatureFlags.OpenFeature" Version="2.3.3" />
                    
Directory.Packages.props
<PackageReference Include="Datadog.FeatureFlags.OpenFeature" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Datadog.FeatureFlags.OpenFeature --version 2.3.3
                    
#r "nuget: Datadog.FeatureFlags.OpenFeature, 2.3.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Datadog.FeatureFlags.OpenFeature@2.3.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Datadog.FeatureFlags.OpenFeature&version=2.3.3
                    
Install as a Cake Addin
#tool nuget:?package=Datadog.FeatureFlags.OpenFeature&version=2.3.3
                    
Install as a Cake Tool

Datadog.FeatureFlags.OpenFeature NuGet package

This package contains the OpenFeature provider for Datadog .NET Feature Flags Events platform (FFE).

What does Datadog.Trace.OpenFeature contain?

Datadog.Trace.OpenFeature contains two things:

  • A reference to the OpenFeature v2 NuGet package for custom instrumentation.
  • The native binaries required for automatic instrumentation, for the Continuous Profiler, and for ASM.

These native binaries are identical to those installed by the MSI and Linux installer packages, so Datadog.Trace.Bundle should be considered an alternative deployment mechanism for automatic instrumentation.

The main advantages of Datadog.Trace.Bundle over the MSI or Linux packages are:

  • You can use it in locations where you cannot access the underlying host to install the MSI or Linux package.
  • You can have multiple applications on the same host using different versions of Datadog.Trace.Bundle without issue.

Getting Started

  1. Configure the Datadog agent for APM as described in our documentation.
  2. Configure the tracer as shown in the next section
  3. Configure the Datadog OpenFeature SDK as described in our documentation.
    1. Add the Datadog.FeatureFlags.OpenFeature NuGet package to your project, using dotnet add package Datadog.FeatureFlags.OpenFeature, for example.
    2. Add the Datadog.FeatureFlags.OpenFeature.DatadogProvider to the OpenFeature.Api.Instance.
  4. Use the OpenFeature.FeatureClient to retrieve configured feature flags from Datadog's backend.
  5. View your live data on Datadog.

Configure the tracer

After adding the NuGet package to your project, set the following required environment variables to enable automatic instrumentation of your application and restart the application.

NOTE: The following are the mandatory variables. For further configuration options, see our public documentation for the Tracer and the Continuous Profiler.

.NET Core:

CORECLR_ENABLE_PROFILING=1
CORECLR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
CORECLR_PROFILER_PATH=<System-dependent path>
DD_DOTNET_TRACER_HOME=<APP_DIRECTORY>/datadog

.NET Framework:

COR_ENABLE_PROFILING=1
COR_PROFILER={846F5F1C-F9AE-4B07-969E-05C26BC060D8}
COR_PROFILER_PATH=<System-dependent path>
DD_DOTNET_TRACER_HOME=<APP_DIRECTORY>/datadog

The value for the <APP_DIRECTORY> placeholder is the path to the directory containing the application’s .dll files. The value for the CORECLR_PROFILER_PATH/COR_PROFILER_PATH environment variable varies based on the system where the application is running:

OPERATING SYSTEM AND PROCESS ARCHITECTURE CORECLR_PROFILER_PATH VALUE
Alpine Linux x64 <APP_DIRECTORY>/datadog/linux-musl-x64/Datadog.Trace.ClrProfiler.Native.so
Linux x64 <APP_DIRECTORY>/datadog/linux-x64/Datadog.Trace.ClrProfiler.Native.so
Alpine Linux ARM64 <APP_DIRECTORY>/datadog/linux-musl-arm64/Datadog.Trace.ClrProfiler.Native.so
Linux ARM64 <APP_DIRECTORY>/datadog/linux-arm64/Datadog.Trace.ClrProfiler.Native.so
Windows x64 <APP_DIRECTORY>\datadog\win-x64\Datadog.Trace.ClrProfiler.Native.dll
Windows x86 <APP_DIRECTORY>\datadog\win-x86\Datadog.Trace.ClrProfiler.Native.dll

For Docker images running on Linux, configure the image to run the createLogPath.sh script:

RUN /<APP_DIRECTORY>/datadog/createLogPath.sh

Examples

Docker examples are available here

Flag selection

A service that needs only some of its flags can load only those, by tag, by key pattern, or both. Datadog filters the flag configuration before sending it, so the service downloads and holds less.

using Datadog.FeatureFlags.OpenFeature;

var provider = new DatadogProvider(new DatadogProviderOptions
{
    FlagSelection = new FlagSelection
    {
        Tags = ["checkout"],
        KeyPatterns = ["checkout.*"],
    },
});
await OpenFeature.Api.Instance.SetProviderAsync(provider);
  • A flag loads when it has any of the tags or its key matches any of the patterns. Tags match exactly. A pattern matches the whole key, * matches any run of characters, and every other character is literal. Matching is case-sensitive.
  • Evaluating a flag outside the selection returns the default value with FLAG_NOT_FOUND. A selection that matches no flag loads no flags.
  • Values are trimmed of surrounding white space, and empty and duplicate values are dropped. Each list then takes at most 31 values of at most 200 UTF-8 bytes each, and the request URL that carries the selection is at most 8192 bytes. A selection outside these limits, or with a null or malformed value, is not sent: every flag loads, and the tracer log names the limit.
  • The selection is copied when the provider is constructed. The first provider constructed in a process decides the selection for every provider in it, until all of them have been shut down or disposed; a later provider with a different selection logs a warning and uses the first one. To change the selection, shut down or dispose every existing provider before you construct the new one. OpenFeature constructs a replacement provider before it shuts down the old one, so swapping providers keeps the first selection.
  • The selection applies to the default agentless configuration source. With the Remote Config source, every flag loads and a warning is logged.
  • This needs tracer 3.58.0 or later. With an older tracer, the selection is not sent and every flag loads, without a warning.

Exposures in your own data store

The provider sends exposures to Datadog. To record exposures in your own data store, use ExposureHook. It receives every completed evaluation, with the same exposure decision that the provider uses for Datadog, the selected split's serial id, and the features of the selected split. Only an ExposureHook added with Api.Instance.AddHooks also receives the synchronous evaluations.

using System.Collections.Concurrent;
using Datadog.FeatureFlags.OpenFeature;
using OpenFeature;

var queue = new BlockingCollection<ExposureRecord>(10_000);

OpenFeature.Api.Instance.AddHooks(new ExposureHook(evaluation =>
{
    if (!evaluation.ShouldSend)
    {
        return;
    }

    // A split without holdout features gives null here.
    evaluation.Features.TryGetValue("holdout.key", out var holdoutKey);
    evaluation.Features.TryGetValue("holdout.assignment_group", out var assignmentGroup);
    // TryAdd never blocks the evaluation: when the queue is full, the record is dropped.
    queue.TryAdd(new ExposureRecord(
        evaluation.FlagKey,
        evaluation.Variant,
        evaluation.TargetingKey,
        evaluation.SplitSerialId,
        holdoutKey as string,
        assignmentGroup as string));
}));
// A background thread drains the queue and writes to the data store.

record ExposureRecord(string FlagKey, string? Variant, string? TargetingKey, long? SplitSerialId, string? HoldoutKey, string? AssignmentGroup);
  • The callback runs on the evaluation thread. Do not write to the data store from the callback: copy what you need and hand it to a background queue. Do not block: use a non-blocking add, so a slow data store cannot delay flag evaluations.
  • ShouldSend is true for a successful evaluation of an allocation that logs exposures, for a subject not yet exposed to the same allocation, variant and serial id. When the provider is registered directly with OpenFeature and you evaluate through a client, these are exactly the exposures the provider sends to Datadog while Datadog logging is on (see When exposures are sent for other setups). The serial id and the verdict require a tracer version that carries this feature; with an older tracer, ShouldSend is false.
  • IsExposure is true for every successful evaluation of an allocation that logs exposures, including repeats. IsCacheHit tells repeats apart.
  • SplitSerialId identifies the selected split in Datadog, as in the exposures the provider sends. Keep it with the exposures you store; it is null when the split has none.
  • An evaluation that fails, including one that an after hook fails, is not an exposure.
  • After the tracer shuts down, exposures are no longer recorded, so evaluations get no decision: ShouldSend and IsCacheHit are false.
  • An exception from the callback does not affect the evaluation. The first one is logged at warn level, later ones at debug level; pass an ILogger to the hook to route them, otherwise only the first one is written, to System.Diagnostics.Trace.

When exposures are sent

The provider records and sends an exposure only after OpenFeature has completed the evaluation without an error, so an evaluation that a later hook fails sends and records nothing. This needs a tracer version that supports it; with an older tracer, the tracer sends the exposure during the evaluation, before hooks run.

With a tracer that supports it, the exposure is sent from a provider hook, so it depends on how the provider's hooks run:

  • If you call the provider's Resolve...ValueAsync methods directly instead of through an OpenFeature client, no hooks run and no exposure is sent or recorded. The synchronous methods below run the provider's hooks and do send exposures.
  • If you wrap DatadogProvider in your own FeatureProvider, return its GetProviderHooks() from your wrapper and pass its FlagMetadata instance through unchanged; otherwise no exposure is sent, and the exposure decisions that ExposureHook reports are not reliable. When 1,000 flag evaluations leave their exposure uncommitted before the provider's hooks ever run, the tracer logs a warning, once per tracer configuration.
  • Inside OpenFeature's MultiProvider, the provider's hooks run inside the multi-provider, before your client's after hooks. If one of those hooks then fails the evaluation, the exposure has already been recorded and queued for Datadog, and ExposureHook reports the evaluation as failed. With a strategy that can return another provider's result, such as ComparisonStrategy, the exposure can also be recorded for a value that your application does not receive.
  • If recording an exposure fails, the provider writes the first failure to System.Diagnostics.Trace.

Features

Features returns the features of the selected split whose destinations include the customer hook, keyed without the __dd_feature. prefix. Values are a string, double or bool, with the type the feature has in the flag configuration: a string feature whose value is "true" or "2026" stays a string. The map is empty when the split has no such features, and with a tracer that does not report split features. A tracer that reports features but not their types gives every value as a string. Datadog can add destinations later; the tracer ignores a destination it does not know and logs a warning once for each one.

Flag metadata

The public flag metadata is the __dd_feature.<key> entries. There is one entry for each feature of the selected split that lists the HOOK destination. The value is a string, double or bool. Read these entries in the hook's finally stage, and skip details that have an error.

Other keys that start with __dd_ are internal. They can change, and they can be missing. ExposureHook gives the exposure decision (IsExposure, IsCacheHit and ShouldSend) and the split's serial id (SplitSerialId).

Stop sending exposures to Datadog

DD_FEATURE_FLAGS_EXPOSURES_DATADOG_LOGGING_ENABLED=false

The provider then sends no exposure events to Datadog. ExposureHook callbacks still receive every evaluation, the exposure cache still records, and ShouldSend gives the same results. The default is true.

This setting stops exposures only. Flag evaluation events have their own setting, DD_FLAGGING_EVALUATION_COUNTS_ENABLED, and are unaffected.

Synchronous evaluation (experimental)

DatadogProvider provides experimental synchronous methods for code that cannot await: ResolveBooleanValue, ResolveIntegerValue, ResolveDoubleValue, ResolveStringValue, and ResolveStructureValue. Each returns OpenFeature ResolutionDetails<T> from the local evaluator. Register the provider with SetProviderAsync first; initialization and configuration delivery remain asynchronous.

using Datadog.FeatureFlags.OpenFeature;
using OpenFeature.Model;

var provider = new DatadogProvider();
await OpenFeature.Api.Instance.SetProviderAsync(provider);
var context = EvaluationContext.Builder().SetTargetingKey("customer-123").Build();

#pragma warning disable DDFF001 // Explicit opt-in to experimental sync resolution.
var result = provider.ResolveBooleanValue("new-checkout", false, context);
#pragma warning restore DDFF001

bool enabled = result.Value;

These methods are Datadog extensions, outside OpenFeature's IFeatureClient API. They use only the context you pass; global, client, and transaction context are not merged, and OpenFeature client lifecycle checks do not run. The provider's own hooks run before the call returns, recording evaluation metrics on supported frameworks, span enrichment and evaluation events when enabled, and exposures. An ExposureHook added with Api.Instance.AddHooks then receives the evaluation, with the final exposure decision. Other hooks registered on the OpenFeature API or a client do not run.

Until configuration arrives, a call returns your default value with ProviderNotReady. Inspect the error details when a default is unsuitable. Cancellation and invalid arguments retain the direct async provider methods' exception behavior.

These APIs report diagnostic DDFF001; suppress it explicitly to opt in. Older compilers may not enforce this diagnostic. Existing async calls require no opt-in.

Get in touch

If you have questions, feedback, or feature requests, reach our support.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.3 0 11/23/2026
2.3.2 49,925 10/5/2026
2.3.1 10,570 9/21/2026
2.3.0 65,871 5/18/2026
2.0.1 24,153 2/23/2026
2.0.0 145,036 1/26/2026

See release notes at https://github.com/DataDog/dd-trace-dotnet/releases.
     Please note that Datadog does not support tracing (manual or automatic) in partial-trust environments.