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
22 23 24 25 26 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 22 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
32 33 34 35 36 37 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 32 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
18 19 20 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 18 def install!(names = LlmCostTracker.configuration.instrumented_integrations) normalize(names).each { |name| fetch(name).install } end |
.normalize(names) ⇒ Object
28 29 30 |
# File 'lib/llm_cost_tracker/integrations/registry.rb', line 28 def normalize(names) Array(names).flatten.map(&:to_sym).uniq end |