Ark/otel api improvements#11
Conversation
6d90418 to
c484680
Compare
11318ac to
ef3f5ab
Compare
ef3f5ab to
b3faeed
Compare
| * <br/><br/> | ||
| * NOTE: This method should only be invoked once. Enabling Braintrust multiple times is unsupported and may lead to undesired behavior | ||
| */ | ||
| public static void enable(@Nonnull BraintrustConfig config, @Nonnull SdkTracerProviderBuilder tracerProviderBuilder, @Nonnull SdkLoggerProviderBuilder loggerProviderBuilder, @Nonnull SdkMeterProviderBuilder meterProviderBuilder) { |
There was a problem hiding this comment.
This is the only new feature of this PR (everything else is refactors, docs, and misc polish)
This is for SDK users who want to add Braintrust alongside their existing open telemetry.
It's slightly different than Go's because the java SDK uses builders with immutable objects so we have to hook the builder phase.
Another thing worth noting is I'm including a hook for otel metrics as well. The reason for this is enterprise Java people are much more willing to bump a dependency version rather than update code (to the point of irrationality at times). So this gives us the option to pull in metrics later without requiring SDK users to update their code
| .build(); | ||
| GlobalOpenTelemetry.set(openTelemetry); | ||
| registerShutdownHook(openTelemetry); | ||
| var braintrustTracer = BraintrustTracing.getTracer(openTelemetry); |
There was a problem hiding this comment.
is this required? or does everything still work if they use the global otel version?
There was a problem hiding this comment.
It's not strictly required. If we can't find the braintrust context on the span data we use the default project that's configured (which can be a project ID or a project name)
There was a problem hiding this comment.
No description provided.