Legion. OpenTelemetry. Adapter. Braintrust
(Legion v0.7.0)
View Source
Legion.OpenTelemetry.Adapter for Braintrust. Exports to the project and
adds braintrust.metadata with Legion's session.id as session_id to
every span, so grouping the logs by session_id shows a conversation in
Thread view.
# config/runtime.exs
if config_env() == :prod do
config :opentelemetry, traces_exporter: {Legion.OpenTelemetry.Exporter, []}
config :legion, Legion.OpenTelemetry,
adapter: :braintrust,
vendor: [
api_key: System.fetch_env!("BRAINTRUST_API_KEY"),
project: "my_app",
region: :eu
]
end
# application.ex
:ok = Legion.OpenTelemetry.attach()Options
:api_key(String.t/0) - Required. Braintrust API key.:project(String.t/0) - Required. Braintrust project the traces are logged to.:region- Data plane of the organization::usor:eu. The default value is:us.