> ## 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

<View title="Developer" />

<View title="Federal docs" />

<View title="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](/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.

<View title="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.
  </Tip>
</View>

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:

<View title="EU docs">\* 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.</View>

<View title="Developer">\* 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.</View>

<View title="Federal docs">\* 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.</View>

<View title="EU docs">\* 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.</View>

<View title="Developer">\* Set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable to `https://otel.observability.app.launchdarkly.com:443`. This variable works with all server-side SDKs.</View>

<View title="Federal docs">\* Set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable to `https://otel.observability.app.launchdarkly.com:443`. This variable works with all server-side SDKs.</View>

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)
* [Node.js (server-side)](#node-js-server-side)
* [Python](#python)
* [Ruby](#ruby)

### .NET (server-side)

<Accordion title="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:

  <CodeGroup>
    ```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>
    ```
  </CodeGroup>

  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).
</Accordion>

### Go

<Accordion title="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:

  <CodeGroup>
    ```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)
    ```
  </CodeGroup>

  For a complete list of configuration options, read [`Option`](https://pkg.go.dev/github.com/launchdarkly/observability-sdk/go#Option).
</Accordion>

### Node.js (server-side)

<Accordion title="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:

  <CodeGroup>
    ```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'
          })
        ]
      }
    )
    ```
  </CodeGroup>

  For a complete list of configuration options, read [`NodeOptions`](https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-node/interfaces/NodeOptions.html).
</Accordion>

### Python

<Accordion title="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:

  <CodeGroup>
    ```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)
    ```
  </CodeGroup>

  For a complete list of configuration options, read [`ObservabilityConfig`](https://launchdarkly.github.io/observability-sdk/sdk/@launchdarkly/observability-python/ldobserve.html#ObservabilityConfig).
</Accordion>

### Ruby

<Accordion title="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:

  <CodeGroup>
    ```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'
    )
    ```
  </CodeGroup>

  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.
  </Note>
</Accordion>
