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

# Configuration for server-side observability

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

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

## Overview

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 on the left, or find your SDK under [Observability SDKs](/sdk/observability#observability-sdks).

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

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

## 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)](#nodejs-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" 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" 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" 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`.

  #### Open

  Telemetry 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" 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" 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+" 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 title="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>
