class RubyLLM::OpenTelemetry
Optional OpenTelemetry tracing through RubyLLM’s instrumentation events. Configure your application’s SDK and exporters before calling .enable.
Public Class Methods
Source
# File lib/ruby_llm/open_telemetry.rb, line 26 def disable @mutex.synchronize { Support::Instrumentation.unsubscribe(@subscriber) if @subscriber } nil end
Disables tracing for new operations without shutting down the SDK. Operations already running finish their spans normally.
Source
# File lib/ruby_llm/open_telemetry.rb, line 13 def enable require 'opentelemetry-api' @mutex.synchronize do @subscriber ||= new Support::Instrumentation.subscribe(@subscriber) end nil rescue LoadError raise LoadError, "OpenTelemetry tracing requires the 'opentelemetry-api' gem. Add it to your Gemfile." end
Enables tracing without replacing the configured instrumenter. Requires the optional opentelemetry-api gem. Repeated calls are harmless. The application owns the tracer provider, SDK, and exporters.