< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Langfuse.LangfuseExportGuard
Assembly: NexusLabs.Needlr.AgentFramework.Langfuse
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Langfuse/LangfuseExportGuard.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 30
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
WarnIfCredentialsWithoutTarget(...)100%66100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Langfuse/LangfuseExportGuard.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Langfuse;
 2
 3/// <summary>
 4/// Shared guard logic for the Langfuse export entry points. Surfaces a diagnostic when credentials
 5/// are present but no explicit export target was chosen, so the "disabled to avoid cloud egress"
 6/// decision is visible rather than silent.
 7/// </summary>
 8internal static class LangfuseExportGuard
 9{
 10    /// <summary>
 11    /// Invokes <see cref="LangfuseOptions.DiagnosticsCallback"/> when credentials are present and
 12    /// enabled but neither a <see cref="LangfuseOptions.Host"/> nor a
 13    /// <see cref="LangfuseOptions.Region"/> was set, explaining why export is disabled.
 14    /// </summary>
 15    /// <param name="options">The export options.</param>
 16    public static void WarnIfCredentialsWithoutTarget(LangfuseOptions options)
 17    {
 618        ArgumentNullException.ThrowIfNull(options);
 19
 620        if (options.HasCredentials && !options.HasExplicitTarget)
 21        {
 222            options.DiagnosticsCallback?.Invoke(
 223                "Langfuse credentials were provided but no export target was set, so export is " +
 224                "disabled. This prevents accidentally sending traces (which may include prompts, " +
 225                "agent outputs, and customer data) to Langfuse Cloud. Set LangfuseOptions.Host for " +
 226                "a self-hosted deployment, or LangfuseOptions.Region to opt in to a Langfuse Cloud " +
 227                "region.");
 28        }
 529    }
 30}