Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Server-side SDKs
Here are the configuration options for private context and user attributes in server-side SDKs:- .NET (server-side)
- Apex
- C++ (server-side)
- Erlang
- Go
- Haskell
- Java
- Lua
- Node.js (server-side)
- PHP
- Python
- Ruby
- Rust
.NET (server-side)
Expand .NET (server-side) code sample
Expand .NET (server-side) code sample
In the server-side .NET SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also mark attributes as private when building the context object by calling When the SDK sends this context back to LaunchDarkly, it removes the
- When creating the LaunchDarkly
Configurationobject, you can configureEventswithAllAttributesPrivate, which takes in a boolean parameter. Iftrue, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the key. - Or, you can configure
EventswithPrivateAttributes, which takes any number of attribute names or slash-delimited paths to designated a JSON property within an attribute, such as/address/street. If any context has a custom or built-in attribute that matches one of these names, the SDK removes it before sending the context to LaunchDarkly.
Private() after setting the attribute on the context builder.For example:email attribute.Apex
Expand Apex code sample
Expand Apex code sample
You can configure the Apex SDK to treat some or all user attributes as private user attributes, either using the You can also define private attribute names on a per-user basis:
LDConfig object or on a per-user basis.When creating the LDConfig object, you can use setAllAttributesPrivate(true). When you do this, all user attributes, except the key, are redacted before the SDK sends the user to LaunchDarkly.Here’s how:C++ (server-side)
Expand C++ (server-side) code sample
Expand C++ (server-side) code sample
In the C++ SDK there are three ways to define private attributes for the LaunchDarkly client:To learn more, read
-
When creating the config object, you can use
AllAttributesPrivate. When you do this, the SDK only sends the context key and kind to LaunchDarkly. For example:
-
When creating the config object, you can list specific private attributes with
PrivateAttributes. The SDK removes all attributes in this list before sending the context to LaunchDarkly. Here’s how:
- You can also define private attributes on a per-context basis. For example:
ContextBuilder.Erlang
Expand Erlang code sample
Expand Erlang code sample
Here’s how to set context attributes as private for all or just some contexts:Here’s how to set context attributes as private for a specific context:In the example, only the
name and /address/street attributes are private for this context.Go
Expand Go code sample
Expand Go code sample
In the Go SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also define a set of private attributes on the context object itself. In the following example, “email” and the “street” field of the “address” attribute are private for this context, in addition to any private attributes that were specified globally:
- You can set the configuration option
AllAttributesPrivateto true. If you enable this, the SDK removes all attributes for all contexts before it sends the context to LaunchDarkly, except the key and kind. - You can set the configuration option
PrivateAttributesto a list of attribute names. If any context has an attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
Haskell
Expand Haskell code sample
Expand Haskell code sample
Optionally, you can configure the Haskell SDK to treat some or all context attributes as private attributes. You can use private context attributes for targeting purposes, but the SDK removes private context attributes from the data it sends to LaunchDarkly.There are two ways to define private attributes for the entire LaunchDarkly client:You can also define private attribute names on a per-context basis.For example:
- When you create the
Configobject, useconfigSetAllAttributesPrivateto set all context attributes as private. When you do this, all context attributes, except the key and kind, are removed before the SDK sends the context to LaunchDarkly. - When you create the
Configobject, you can list specific private attributes withconfigSetPrivateAttributeNames. If any context has attributes named in this list, the SDK removes them before sending the context to LaunchDarkly.
Java
Expand Java code sample
Expand Java code sample
In the Java SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also mark attributes as private when building the context object by calling the When the SDK sends this context back to LaunchDarkly, it removes the
- When creating the
LDConfigobject, you can call theallAttributesPrivatemethod, which takes in a boolean parameter. Iftrue, all context attributes except the key for all contexts are removed before the SDK sends the context to LaunchDarkly. - When creating the
LDConfigobject, you can call theprivateAttributesmethod, which takes in a set of custom or built-in attributes as a parameter. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes builder method. For example:email attribute.Lua
Expand Lua code sample
Expand Lua code sample
In the Lua SDK there are two ways to define private attributes for the LaunchDarkly client:You can also define private attributes for a particular context using a list of To learn more, read
- Use
allAttributesPrivateto remove all context attributes except for the kind and key from all contexts before the SDK sends the contexts to LaunchDarkly. - Use
privateAttributesto designate a list of private attributes. If any context has an attribute named in this list, the SDK removes that attribute before sending the context to LaunchDarkly.
privateAttributes:clientInit and makeContext.Node.js (server-side)
Expand Node.js (server-side) code sample
Expand Node.js (server-side) code sample
In the Node.js SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also define a set of When the SDK sends this context back to LaunchDarkly, it removes the
- In the LaunchDarkly
LDOptions, you can setallAttributesPrivatetotrue. If you enable this, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the kind and key. - In the LaunchDarkly
LDOptionsobject, you can define a list ofprivateAttributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes on the context object. For example:email attribute.PHP
Expand PHP code sample
Expand PHP code sample
In the PHP SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also mark attributes as private when building the context object by calling the equivalent “private” When the SDK sends this context back to LaunchDarkly, it removes the
- In the LaunchDarkly
config, you can setall_attributes_privatetotrue. If you enable this, the SDK removes all attributes except the key and kind from a context before sending the context to LaunchDarkly. - In the LaunchDarkly
configobject, you can define a list ofprivate_attribute_names. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
LDContextBuilder method.For example:email attribute.Python
Expand Python code sample
Expand Python code sample
In the Python SDK there are two ways to define private attributes for the LaunchDarkly client:You can also mark attributes as private when building the context object by calling the When the SDK sends this context back to LaunchDarkly, it removes the
- In the LaunchDarkly
config, you can setall_attributes_privateto true. If you enable this, the SDK removes all context attributes for all contexts before sending the context to LaunchDarkly, except the key. - In the LaunchDarkly
configobject, you can define a list of attributes inprivate_attributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
private builder method. For example:email attribute.Ruby
Expand Ruby code sample
Expand Ruby code sample
In the Ruby SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also define a set of When the SDK sends this context back to LaunchDarkly, it removes the
- In the LaunchDarkly
config, you can setall_attributes_privateto true. If you enable this, the SDK removes all context attributes for all contexts before sending the context to LaunchDarkly, except the key. - In the LaunchDarkly config object, you can define a list of
private_attributes. If any context has a custom or built-in attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
privateAttributes on the context object. For example:email attribute.Rust
Expand Rust code sample
Expand Rust code sample
In the Rust SDK there are two ways to define private attributes for the entire LaunchDarkly client:You can also define private attributes on the context object. For example:When the SDK sends this context back to LaunchDarkly, it removes the
- In the LaunchDarkly config object, you can set
all_attributes_privateto true. If you enable this, the SDK removes all attributes for all contexts before sending the context to LaunchDarkly, except the key and kind. - In the LaunchDarkly config object, you can define a list of
private_attributes. If any contexts has an attribute named in this list, the SDK removes it before sending the context to LaunchDarkly.
email attribute.