Module: LlmCostTracker::Integrations::Registry
- Defined in:
- lib/llm_cost_tracker/integrations/registry.rb
Constant Summary collapse
Class Method Summary collapse
- .checks(names = LlmCostTracker.configuration.instrumented_integrations) ⇒ Object
- .fetch(name) ⇒ Object
- .install!(names = LlmCostTracker.configuration.instrumented_integrations) ⇒ Object
- .normalize(names) ⇒ Object
Class Method Details
.checks(names = LlmCostTracker.configuration.instrumented_integrations) ⇒ Object
20 21 22 23 24 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 20 def checks(names = LlmCostTracker.configuration.instrumented_integrations) return [Base::Result.new(:integrations, :ok, "no SDK integrations enabled")] if names.empty? normalize(names).map { |name| fetch(name).status } end |
.fetch(name) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 30 def fetch(name) INTEGRATIONS.fetch(name.to_sym) do = "Unknown integration: #{name.inspect}. Use one of: #{INTEGRATIONS.keys.join(', ')}" raise LlmCostTracker::Error, end end |
.install!(names = LlmCostTracker.configuration.instrumented_integrations) ⇒ Object
16 17 18 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 16 def install!(names = LlmCostTracker.configuration.instrumented_integrations) normalize(names).each { |name| fetch(name).install } end |
.normalize(names) ⇒ Object
26 27 28 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 26 def normalize(names) Array(names).flatten.map(&:to_sym).uniq end |