> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration for server-side observability

**Developer**

**Federal docs**

**EU docs**

This topic explains how to configure the observability plugin for server-side SDKs.

The observability plugin collects and sends observability data to LaunchDarkly, so you can review error monitoring, logs, traces, and more from within the LaunchDarkly UI.

To get started with the observability plugin, read the observability reference guide for your SDK. Use the docs site navigation, or find your SDK under [Observability SDKs](https://launchdarkly.com/docs/sdk/observability#observability-sdks).

Details about each SDK's configuration are available in the SDK-specific sections below:

* [Server-side SDKs](#server-side-sdks)

## Network requirements

The observability plugin sends OpenTelemetry data to LaunchDarkly at `https://otel.observability.app.launchdarkly.com:4318` by default. Port 4318 is the standard OpenTelemetry HTTP/Protobuf port.

**EU docs**

> [!TIP]
>
> **Set the EU endpoint explicitly**
>
> The observability plugin defaults to the LaunchDarkly commercial endpoint. In the LaunchDarkly EU instance, override the OpenTelemetry Protocol (OTLP) endpoint to `https://otel.observability.app.eu.launchdarkly.com:4318` using either of the methods described below.

If your network restricts outbound traffic to port 443, override the OTLP endpoint to use HTTPS on port 443. You have two ways to override the endpoint:

\* Use the configuration option for your SDK. For example, in .NET, call `WithOtlpEndpoint("https://otel.observability.app.eu.launchdarkly.com:443")` when you build the plugin.

\* Use the configuration option for your SDK. For example, in .NET, call `WithOtlpEndpoint("https://otel.observability.app.launchdarkly.com:443")` when you build the plugin.

\* Use the configuration option for your SDK. For example, in .NET, call `WithOtlpEndpoint("https://otel.observability.app.launchdarkly.com:443")` when you build the plugin.

\* Set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable to `https://otel.observability.app.eu.launchdarkly.com:443`. This variable works with all server-side SDKs except Java. In Java, use the `otlpEndpoint` option.

\* Set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable to `https://otel.observability.app.launchdarkly.com:443`. This variable works with all server-side SDKs except Java. In Java, use the `otlpEndpoint` option.

\* Set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable to `https://otel.observability.app.launchdarkly.com:443`. This variable works with all server-side SDKs except Java. In Java, use the `otlpEndpoint` option.

If your application emits OpenTelemetry data locally but none of it appears in LaunchDarkly, check whether your network allows outbound traffic to port 4318. A restrictive firewall is a common cause of missing backend observability data.

## Server-side SDKs

This feature is available in the observability plugin for the following server-side SDKs:

* [.NET (server-side)](#net-server-side)
* [Go](#go)
* [Java](#java)
* [Node.js (server-side)](#node-js-server-side)
* [Python](#python)
* [Ruby](#ruby)

### .NET (server-side)

> [accordion] Expand .NET (server-side) code sample
>
> You can configure the observability plugin for the .NET (server-side) SDK through a mix of environment variables, OpenTelemetry configuration options, and plugin configuration options.
>
> Use the `ObservabilityPlugin.ObservabilityPluginBuilder` to set the options. In many cases, you can use an OpenTelemetry-specific environment variable instead, if you prefer. For example, if you want to set a custom OTLP endpoint, you can either set `OtlpEndpoint` in your `ObservabilityPlugin.ObservabilityPluginBuilder`, or you can set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable.
>
> Here's how:
>
> ```csharp title="Plugin configuration with ASP.Net Core" expandable lines wrap theme={null}
> var builder = WebApplication.CreateBuilder(args);
>
> var config = Configuration.Builder("YOUR_SDK_KEY")
>     .Plugins(new PluginConfigurationBuilder()
>         .Add(ObservabilityPlugin.Builder(builder.Services)
>             .WithServiceName("example-service")
>             // we recommend setting service version to the latest deployed git SHA
>             .WithServiceVersion("example-sha")
>             .Build())).Build();
>
> // Building the LdClient with the Observability plugin. This line will add services to the web application.
> var client = new LdClient(config);
>
> // Client must be built before your web application.
> var app = builder.Build();
>
> ```
>
> ```csharp title="Plugin configuration with ASP.Net .Net Framework" expandable lines wrap theme={null}
> // Global.asax.cs
> protected void Application_Start()
> {
>     // Other application specific code.
>
>     var client = new LdClient(Configuration.Builder("YOUR_SDK_KEY")
>         .Plugins(new PluginConfigurationBuilder().Add(ObservabilityPlugin.Builder()
>             .WithServiceName("classic-asp-application")
>             .Build()))
>         .Build());
> }
>
> protected void Application_End() {
>     Observe.Shutdown();
> }
>
> <!-- Web.config -->
> <system.webServer>
>   // Any existing content should remain and the following should be added.
>   <modules>
>   <add name="TelemetryHttpModule" type="OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule,
>     OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule" preCondition="integratedMode,managedHandler" />
>   </modules>
> </system.webServer>
> ```
>
> For a complete list of configuration options, read [`ObservabilityPlugin.ObservabilityPluginBuilder`](https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-dotnet/api/LaunchDarkly.Observability.ObservabilityPlugin.ObservabilityPluginBuilder.html).

### Go

> [accordion] Expand Go code sample
>
> You can configure the observability plugin for the Go SDK through the plugin's options.
>
> Use the functions in the [`Option`](https://pkg.go.dev/github.com/launchdarkly/observability-sdk/go#Option) type to set the options.
>
> Here's how:
>
> ```go title="Plugin configuration options" lines wrap theme={null}
> client, _ := ld.MakeCustomClient("YOUR_SDK_KEY",
>   ld.Config{
>     Plugins: []ldplugins.Plugin{
>       ldobserve.NewObservabilityPlugin(
>         ldobserve.WithServiceName("example-service"),
>         // we recommend setting service version to the latest deployed git SHA
>         ldobserve.WithServiceVersion("example-sha"),
>       ),
>     },
>   }, 5*time.Second)
> ```
>
> For a complete list of configuration options, read [`Option`](https://pkg.go.dev/github.com/launchdarkly/observability-sdk/go#Option).

### Java

> [accordion] Expand Java code sample
>
> You can configure the observability plugin for the Java SDK through the plugin's options. The Java plugin does not read OpenTelemetry environment variables such as `OTEL_EXPORTER_OTLP_ENDPOINT` or `OTEL_SERVICE_NAME`, so set these values through the plugin options instead.
>
> Use `ObservabilityOptions.Builder` to set the options.
>
> Here's how:
>
> ```java title="Plugin configuration options" lines wrap theme={null}
> ObservabilityPlugin plugin = new ObservabilityPlugin(
>     new ObservabilityOptions.Builder()
>         .serviceName("example-service")
>         // we recommend setting serviceVersion to the latest deployed git SHA
>         .serviceVersion("example-sha")
>         .environment("production")
>         .build()
> );
> ```
>
> This table lists the available options:
>
> <table>
>   <thead>
>     <tr>
>       <th>Option</th>
>       <th>Default</th>
>       <th>Description</th>
>     </tr>
>   </thead>
>
>   <tbody>
>     <tr>
>       <td>`enabled`</td>
>       <td>`true`</td>
>       <td>When `false`, the plugin starts no providers, registers no flag evaluation hook, does not fetch sampling configuration, and `LDObserve` methods do nothing.</td>
>     </tr>
>
>     <tr>
>       <td>`serviceName`</td>
>       <td>Empty</td>
>       <td>The service name, set as the `service.name` resource attribute.</td>
>     </tr>
>
>     <tr>
>       <td>`serviceVersion`</td>
>       <td>Empty</td>
>       <td>The service version, set as the `service.version` resource attribute.</td>
>     </tr>
>
>     <tr>
>       <td>`environment`</td>
>       <td>Empty</td>
>       <td>The deployment environment name, set as the `deployment.environment.name` resource attribute.</td>
>     </tr>
>
>     <tr>
>       <td>`otlpEndpoint`</td>
>       <td>LaunchDarkly endpoint</td>
>       <td>A custom OTLP/HTTP endpoint.</td>
>     </tr>
>
>     <tr>
>       <td>`backendUrl`</td>
>       <td>LaunchDarkly endpoint</td>
>       <td>A custom URL for fetching sampling configuration.</td>
>     </tr>
>
>     <tr>
>       <td>`resourceAttributes`</td>
>       <td>Empty</td>
>       <td>Additional resource attributes. These are merged over the plugin's defaults, which means they can override `service.name` and other default attributes.</td>
>     </tr>
>
>     <tr>
>       <td>`customHeaders`, `customHeader`</td>
>       <td>None</td>
>       <td>Headers to send with every OTLP export and sampling configuration request.</td>
>     </tr>
>
>     <tr>
>       <td>`proxySelector`, `proxyHostAndPort`</td>
>       <td>Java Virtual Machine (JVM) default</td>
>       <td>An egress proxy for exports and sampling configuration requests.</td>
>     </tr>
>
>     <tr>
>       <td>`logsApiLevel`</td>
>       <td>`INFO`</td>
>       <td>The minimum severity of exported logs. `NONE` turns off log export.</td>
>     </tr>
>
>     <tr>
>       <td>`debug`</td>
>       <td>`false`</td>
>       <td>Turns on debug logging.</td>
>     </tr>
>
>     <tr>
>       <td>`manualStart`</td>
>       <td>`false`</td>
>       <td>Delays provider startup until you call `LDObserve.start(sdkKey, options)`.</td>
>     </tr>
>
>     <tr>
>       <td>`shutdownHook`</td>
>       <td>`true`</td>
>       <td>Flushes and stops the providers from a JVM shutdown hook. Set this to `false` when a framework such as Spring Boot manages shutdown, and call `LDObserve.shutdown()` from its close callback.</td>
>     </tr>
>   </tbody>
> </table>
>
> The OTLP exporters and the sampling configuration request both use `java.net.http.HttpClient`, so they behave the same way behind an egress proxy. If you do not configure a proxy, the JVM default proxy selector applies. It honors the `https.proxyHost`, `https.proxyPort`, and `http.nonProxyHosts` system properties. To set a proxy or headers explicitly, use `proxyHostAndPort` and `customHeader`. To apply per-host proxy rules, pass a `java.net.ProxySelector` to `proxySelector`.
>
> Here's how:
>
> ```java title="Proxy, headers, and log level" lines wrap theme={null}
> new ObservabilityOptions.Builder()
>     .proxyHostAndPort("egress.example.com", 3128)
>     .customHeader("X-Example-Header", "example-value")
>     // export WARN, ERROR, and FATAL logs
>     .logsApiLevel(ObservabilityOptions.LogLevel.WARN)
>     .build();
> ```
>
> The available log levels are `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, `FATAL`, and `NONE`, matching the OpenTelemetry severity numbers. The plugin treats a log record with no severity as `TRACE`.
>
> For a complete list of configuration options, read [Configuration Options](https://github.com/launchdarkly/observability-sdk/tree/main/sdk/%40launchdarkly/observability-java#configuration-options) in the plugin README.

### Node.js (server-side)

> [accordion] Expand Node.js (server-side) code sample
>
> You can configure the observability plugin for the Node.js (server-side) SDK through a mix of environment variables, OpenTelemetry configuration options, and plugin configuration options.
>
> #### Environment variables
>
> The environment variables specify where to enable instrumentation:
>
> * `LAUNCHDARKLY_OTEL_NODE_ENABLE_FILESYSTEM_INSTRUMENTATION` enables file system instrumentation. It defaults to `false`.
> * `LAUNCHDARKLY_OTEL_NODE_ENABLE_OUTGOING_HTTP_INSTRUMENTATION` enables outgoing HTTP instrumentation. It defaults to `true`. It only affects outgoing HTTP requests instrumented by `@opentelemetry/instrumentation-http`.
>
> #### OpenTelemetry configuration options
>
> If you are already using [OpenTelemetry configuration options for Node](https://opentelemetry.io/docs/zero-code/js/configuration/) in your application, you can continue to use them.
>
> When you use the observability plugin, the `@opentelemetry/instrumentation-fs` instrumentation behaves as follows:
>
> * The instrumentation will only be enabled if `LAUNCHDARKLY_OTEL_NODE_ENABLE_FILESYSTEM_INSTRUMENTATION` is `true`.
> * The instruction is unaffected by the `OTEL_NODE_ENABLED_INSTRUMENTATIONS` and `OTEL_NODE_DISABLED_INSTRUMENTATIONS` OpenTelemetry environment variables.
>
> #### Plugin configuration options
>
> To specify the observability plugin configuration options, use the `NodeOptions` interface to set the options.
>
> Here's how:
>
> ```js title="Plugin configuration options" lines wrap theme={null}
> const client = init(
>   'YOUR_SDK_KEY',
>   {
>     plugins: [
>       new Observability({
>         serviceName: 'example-service',
>         // we recommend setting serviceVersion to the latest deployed git SHA
>         serviceVersion: 'example-sha'
>       })
>     ]
>   }
> )
> ```
>
> For a complete list of configuration options, read [`NodeOptions`](https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-node/interfaces/NodeOptions.html).

### Python

> [accordion] Expand Python code sample
>
> You can configure the observability plugin for the Python SDK through a mix of environment variables, OpenTelemetry configuration options, and plugin configuration options.
>
> Use the `ObservabilityConfig` class to set the options. In many cases, you can use an OpenTelemetry-specific environment variable instead, if you prefer. For example, if you want to set a custom OTLP endpoint, you can either set `otlp_endpoint` in your `ObservabilityConfig`, or you can set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable.
>
> Here's how:
>
> ```python title="Plugin configuration options" lines wrap theme={null}
> observability_config = ObservabilityConfig(
>   # alternatively, set the OTEL_SERVICE_NAME environment variable
>   service_name = "example-service",
>   # we recommend setting service_version to the latest deployed git SHA
>   service_version = "example-sha"
> )
>
> plugin = ObservabilityPlugin(observability_config)
> ```
>
> For a complete list of configuration options, read [`ObservabilityConfig`](https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-python/ldobserve.html#ObservabilityConfig).

### Ruby

> [accordion] Expand Ruby code sample
>
> You can configure options for the Ruby observability plugin when you initialize the SDK, or using environment variables.
>
> #### Plugin configuration options
>
> The plugin constructor accepts optional keyword arguments for configuration.
>
> Here's how:
>
> ```ruby title="Plugin options, Ruby SDK v8.0+" lines wrap theme={null}
> plugin = LaunchDarklyObservability::Plugin.new(
> service_name: 'example-service',
> # we recommend setting service_version to the latest deployed git SHA
> service_version: 'example-sha'
> )
> ```
>
> For a complete list of configuration options, read [Plugin Options](https://github.com/launchdarkly/observability-sdk/tree/main/sdk/%40launchdarkly/observability-ruby#plugin-options).
>
> #### Environment variables
>
> The environment variables specify where to enable instrumentation:
>
> * `LAUNCHDARKLY_SDK_KEY` provides the LaunchDarkly SDK key. This key is automatically extracted from the client during initialization.
>
> * `OTEL_EXPORTER_OTLP_ENDPOINT` provides a custom OTLP endpoint.
>
> * `OTEL_SERVICE_NAME` provides the service name, if not specified in plugin options.
>
> > [!NOTE]
> >
> > **Environment configuration is automatic**
> >
> > The environment associated with your SDK key is automatically determined by the backend, so you don't need to configure it separately.
