LaunchDarkly Observability plugin for the Server-Side SDK for .NET
Search Results for

    Show / Hide Table of Contents

    Class BaseBuilder<TBuilder>

    Base builder which allows for methods to be shared between building a config directly and building a plugin. This uses the CRTP pattern to allow the individual builder methods to return instances of the derived builder type.

    Inheritance
    object
    BaseBuilder<TBuilder>
    ObservabilityConfig.ObservabilityConfigBuilder
    ObservabilityPlugin.ObservabilityPluginBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: LaunchDarkly.Observability
    Assembly: LaunchDarkly.Observability.dll
    Syntax
    public class BaseBuilder<TBuilder> where TBuilder : BaseBuilder<TBuilder>
    Type Parameters
    Name Description
    TBuilder

    Constructors

    | Edit this page View Source

    BaseBuilder()

    Declaration
    protected BaseBuilder()

    Methods

    | Edit this page View Source

    WithBackendUrl(string)

    Set the back-end URL for non-telemetry operations.

    For most configurations, the backend url will not need to be set.

    Setting the url to null will reset the builder value to the default.

    Declaration
    public TBuilder WithBackendUrl(string backendUrl)
    Parameters
    Type Name Description
    string backendUrl

    The back-end URL used for non-telemetry operations.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    | Edit this page View Source

    WithEnvironment(string)

    Set the environment name.

    Declaration
    public TBuilder WithEnvironment(string environment)
    Parameters
    Type Name Description
    string environment

    The environment name (for example, "prod" or "staging").

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    | Edit this page View Source

    WithExtendedLoggerConfiguration(Action<LoggerProviderBuilder>)

    Method which extends the configuration of the logger provider.

    The basic logger options will already be configured by the LaunchDarkly Observability plugin. This method should be used to extend that configuration with additional instrumentation.

    Configuring exporters or processors may interfere with the operation of the plugin and is not recommended.

    Declaration
    public TBuilder WithExtendedLoggerConfiguration(Action<LoggerProviderBuilder> extendedLoggerConfiguration)
    Parameters
    Type Name Description
    Action<LoggerProviderBuilder> extendedLoggerConfiguration

    A function used to extend the logging configuration.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    Examples

    Adding custom instrumentation:

    ObservabilityConfig.Builder()
        .WithExtendedLoggerConfiguration(builder =>
        {
            builder.AddMyInstrumentation();
        });
    | Edit this page View Source

    WithExtendedMeterConfiguration(Action<MeterProviderBuilder>)

    Method which extends the configuration of the meter provider.

    The basic meter options will already be configured by the LaunchDarkly Observability plugin. This method should be used to extend that configuration with additional meters, views, or custom instrumentation.

    By default, metrics will be configured with the following instrumentation:

    • Runtime Instrumentation (GC, thread pool, JIT statistics)
    • Process Instrumentation (CPU, memory, handle counts)
    • HTTP Client Instrumentation (request counts, durations)
    • AspNetCore Instrumentation (request rates, response times)
    • SQL Client Instrumentation (query execution times, connection pool metrics)

    Configuring exporters or processors may interfere with the operation of the plugin and is not recommended.

    Declaration
    public TBuilder WithExtendedMeterConfiguration(Action<MeterProviderBuilder> extendedMeterConfiguration)
    Parameters
    Type Name Description
    Action<MeterProviderBuilder> extendedMeterConfiguration

    A function used to extend the metrics configuration.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    Examples

    Adding custom instrumentation:

    ObservabilityConfig.Builder()
        .WithExtendedMeterConfiguration(builder =>
        {
            // Add meters from your custom instrumentation
            builder.AddMyInstrumentation();
        });
    | Edit this page View Source

    WithExtendedTracingConfig(Action<TracerProviderBuilder>)

    Method which extends the configuration of the tracer provider.

    The basic tracer options will already be configured by the LaunchDarkly Observability plugin. This method should be used to extend that configuration with additional instrumentation or additional activity sources.

    By default tracing will be configured with the following instrumentation:

    • HTTP Client Instrumentation
    • GRPC Client Instrumentation
    • WCF Instrumentation
    • Quart Instrumentation
    • AspNetCore Instrumentation
    • SQL Client Instrumentation

    Configuring exporters or processors may interfere with the operation of the plugin and is not recommended.

    Declaration
    public TBuilder WithExtendedTracingConfig(Action<TracerProviderBuilder> extendedTracerConfiguration)
    Parameters
    Type Name Description
    Action<TracerProviderBuilder> extendedTracerConfiguration

    A function used to extend the tracing configuration.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    Examples

    Add additional activity sources:

    ObservabilityConfig.Builder()
        .WithExtendedTracingConfig(builder =>
        {
            // Activities started by this activity source will be in exported spans.
            builder.AddSource("my-custom-activity-source");
        });

    Add additional instrumentation.

    ObservabilityConfig.Builder()
        .WithExtendedTracingConfig(builder =>
        {
            builder.AddMyInstrumentation()
        });
    | Edit this page View Source

    WithOtlpEndpoint(string)

    Set the OTLP endpoint.

    For most configurations, the OTLP endpoint will not need to be set.

    If not explicitly set, set to null, or set to whitespace/empty string, the OTLP endpoint will be read from the OTEL_EXPORTER_OTLP_ENDPOINT environment variable. Values set with this method take precedence over the environment variable.

    Setting the endpoint to null will reset the builder value to the default.

    Declaration
    public TBuilder WithOtlpEndpoint(string otlpEndpoint)
    Parameters
    Type Name Description
    string otlpEndpoint

    The OTLP exporter endpoint URL.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    | Edit this page View Source

    WithServiceName(string)

    Set the service name.

    If not explicitly set, set to null, or set to whitespace/empty string, the service name will be read from the OTEL_SERVICE_NAME environment variable. Values set with this method take precedence over the environment variable.

    Declaration
    public TBuilder WithServiceName(string serviceName)
    Parameters
    Type Name Description
    string serviceName

    The logical service name used in telemetry resource attributes.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    | Edit this page View Source

    WithServiceVersion(string)

    Set the service version.

    Declaration
    public TBuilder WithServiceVersion(string serviceVersion)
    Parameters
    Type Name Description
    string serviceVersion

    The version of the service that will be added to resource attributes when a service name is provided.

    Returns
    Type Description
    TBuilder

    A reference to this builder.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX