Class: DSPy::Subscribers::OtelSubscriber::OtelConfig
- Inherits:
-
Object
- Object
- DSPy::Subscribers::OtelSubscriber::OtelConfig
- Extended by:
- T::Sig
- Defined in:
- lib/dspy/subscribers/otel_subscriber.rb
Overview
Configuration for OpenTelemetry integration
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#export_metrics ⇒ Object
Returns the value of attribute export_metrics.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#service_name ⇒ Object
Returns the value of attribute service_name.
-
#service_version ⇒ Object
Returns the value of attribute service_version.
-
#trace_lm_events ⇒ Object
Returns the value of attribute trace_lm_events.
-
#trace_optimization_events ⇒ Object
Returns the value of attribute trace_optimization_events.
Instance Method Summary collapse
-
#initialize ⇒ OtelConfig
constructor
A new instance of OtelConfig.
Constructor Details
#initialize ⇒ OtelConfig
Returns a new instance of OtelConfig.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 52 def initialize @enabled = !!(defined?(OpenTelemetry) && ENV['OTEL_EXPORTER_OTLP_ENDPOINT']) @service_name = ENV.fetch('OTEL_SERVICE_NAME', 'dspy-ruby') @service_version = begin ENV.fetch('OTEL_SERVICE_VERSION', DSPy::VERSION) rescue '1.0.0' end @endpoint = ENV['OTEL_EXPORTER_OTLP_ENDPOINT'] @headers = parse_headers(ENV['OTEL_EXPORTER_OTLP_HEADERS']) @trace_optimization_events = true @trace_lm_events = true @export_metrics = true @sample_rate = ENV.fetch('OTEL_TRACE_SAMPLE_RATE', '1.0').to_f end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
25 26 27 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 25 def enabled @enabled end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
34 35 36 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 34 def endpoint @endpoint end |
#export_metrics ⇒ Object
Returns the value of attribute export_metrics.
46 47 48 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 46 def export_metrics @export_metrics end |
#headers ⇒ Object
Returns the value of attribute headers.
37 38 39 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 37 def headers @headers end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
49 50 51 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 49 def sample_rate @sample_rate end |
#service_name ⇒ Object
Returns the value of attribute service_name.
28 29 30 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 28 def service_name @service_name end |
#service_version ⇒ Object
Returns the value of attribute service_version.
31 32 33 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 31 def service_version @service_version end |
#trace_lm_events ⇒ Object
Returns the value of attribute trace_lm_events.
43 44 45 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 43 def trace_lm_events @trace_lm_events end |
#trace_optimization_events ⇒ Object
Returns the value of attribute trace_optimization_events.
40 41 42 |
# File 'lib/dspy/subscribers/otel_subscriber.rb', line 40 def trace_optimization_events @trace_optimization_events end |