Skip to content

LangfuseServiceCollectionExtensions

NexusLabs.Needlr.AgentFramework.Langfuse

LangfuseServiceCollectionExtensions Class

Registers Langfuse OTLP export on an Microsoft.Extensions.DependencyInjection.IServiceCollection for ASP.NET Core and generic-host applications.

public static class LangfuseServiceCollectionExtensions

Inheritance System.Object 🡒 LangfuseServiceCollectionExtensions

Remarks

Unlike Start(LangfuseOptions) — which builds standalone providers for evals and console apps — this integrates with the host's AddOpenTelemetry() pipeline so the tracer and meter providers share the application lifecycle. When the supplied options are not configured (for example, missing credentials), registration is skipped and the application starts normally without exporting.

Methods

LangfuseServiceCollectionExtensions.AddNeedlrLangfuse(this IServiceCollection, Action<LangfuseOptions>) Method

Adds Langfuse OTLP/HTTP export of Needlr agent telemetry to the host's OpenTelemetry pipeline.

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddNeedlrLangfuse(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<NexusLabs.Needlr.AgentFramework.Langfuse.LangfuseOptions>? configure=null);

Parameters

services Microsoft.Extensions.DependencyInjection.IServiceCollection

The service collection to configure.

configure System.Action<LangfuseOptions>

Optional callback to customise the LangfuseOptions. When null, options are read from the environment via FromEnvironment().

Returns

Microsoft.Extensions.DependencyInjection.IServiceCollection
The same Microsoft.Extensions.DependencyInjection.IServiceCollection for chaining.

Exceptions

System.ArgumentNullException
services is null.