Class BraintrustTracing

java.lang.Object
dev.braintrust.trace.BraintrustTracing

public final class BraintrustTracing extends Object
Main entry point for Braintrust tracing setup. Provides convenient methods to initialize OpenTelemetry with Braintrust configuration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    enable(BraintrustConfig config, io.opentelemetry.sdk.trace.SdkTracerProviderBuilder tracerProviderBuilder, io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder loggerProviderBuilder, io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder meterProviderBuilder)
    Add braintrust to existing open telemetry builders

    This method provides the most options for configuring Braintrust and OpenTelemetry.
    static io.opentelemetry.api.trace.Tracer
    Gets a tracer with Braintrust instrumentation scope.
    static io.opentelemetry.api.trace.Tracer
    getTracer(io.opentelemetry.api.OpenTelemetry openTelemetry)
    Gets a tracer from a specific OpenTelemetry instance.
    static io.opentelemetry.api.OpenTelemetry
    of(BraintrustConfig config, boolean registerGlobal)
    Quick start method that sets up OpenTelemetry with custom Braintrust and otel settings.
    static io.opentelemetry.api.OpenTelemetry
    Quick start method that sets up global OpenTelemetry with Braintrust defaults.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • quickstart

      public static io.opentelemetry.api.OpenTelemetry quickstart()
      Quick start method that sets up global OpenTelemetry with Braintrust defaults.

      If you're looking for more options for configuring Braintrust/OpenTelemetry, consult the `enable` method.
    • of

      public static io.opentelemetry.api.OpenTelemetry of(@Nonnull BraintrustConfig config, boolean registerGlobal)
      Quick start method that sets up OpenTelemetry with custom Braintrust and otel settings.

      If you're looking for more options for configuring Braintrust and OpenTelemetry, consult the `enable` method.
    • enable

      public static void enable(@Nonnull BraintrustConfig config, @Nonnull io.opentelemetry.sdk.trace.SdkTracerProviderBuilder tracerProviderBuilder, @Nonnull io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder loggerProviderBuilder, @Nonnull io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder meterProviderBuilder)
      Add braintrust to existing open telemetry builders

      This method provides the most options for configuring Braintrust and OpenTelemetry. If you're looking for a more user-friendly setup, consult the `quickstart` methods.

      NOTE: if your otel setup does not have any particular builder, pass an instance of the default provider builder. E.g. `SdkMeterProvider.builder()`

      NOTE: This method should only be invoked once. Enabling Braintrust multiple times is unsupported and may lead to undesired behavior
    • getTracer

      public static io.opentelemetry.api.trace.Tracer getTracer()
      Gets a tracer with Braintrust instrumentation scope.
    • getTracer

      public static io.opentelemetry.api.trace.Tracer getTracer(io.opentelemetry.api.OpenTelemetry openTelemetry)
      Gets a tracer from a specific OpenTelemetry instance.