lex-finops 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9cb0d0ed46a270344440e8f344fc319957c74d9d0aae5144e4a0182cb36d063
4
- data.tar.gz: 5aeba9c49abbe8e184da089e1e74f73aa9ba69ccb7e65b47847f3e088c3b1df4
3
+ metadata.gz: 9a27bf85c3b7776a210358ce4783a98e8a5f86aa0ac4ce34d4570822ae4d5a03
4
+ data.tar.gz: a51f68fcc90d4ade3ebfc6ca7602ef62524e87b34b9252541fe0547af32e49d7
5
5
  SHA512:
6
- metadata.gz: 2d7098c01e6135acc49c7c1f6570d91f1bd750f66e859aee47bc89874b42a4af72d87d921ce0bb8e1b9c49c9a8fc725c01d32b00cb9756cd2adb2e7450f8d172
7
- data.tar.gz: 449a3a43392919cce61d9e7033b9a1ef362353ffda0ef71679549771cdb0a98c63e52b97829b41af1efeab5202c940c23760affa2153082a53130255b0e1c97e
6
+ metadata.gz: 1e66fda73d245caf32c0e6c2925a66c56379f082735d3dc8caf6795fc93661bc1d29c323edf6539f86f11b8e11a0175f477d34cb87e3b30fee0b94d42eb65a8a
7
+ data.tar.gz: d4bbd6d7ef2bf49b908eb044ded0c43e0a28b883075ede56818a3747939ac52c339dd8ba415698b56d92fb20dc19b59ce52b36d9fde502e4094998f07d8f9b77
@@ -11,7 +11,7 @@ module Legion
11
11
  ALERT_THRESHOLDS = [50, 75, 90, 100].freeze
12
12
 
13
13
  @mutex = Mutex.new
14
- @budgets = {}
14
+ @budgets = {} # rubocop:disable ThreadSafety/MutableClassInstanceVariable
15
15
 
16
16
  module_function
17
17
 
@@ -33,7 +33,7 @@ module Legion
33
33
  def finops_settings
34
34
  settings = Legion::Settings[:finops]
35
35
  settings.is_a?(Hash) ? settings : {}
36
- rescue StandardError
36
+ rescue StandardError => _e
37
37
  {}
38
38
  end
39
39
  end
@@ -5,6 +5,8 @@ module Legion
5
5
  module Finops
6
6
  module Runners
7
7
  module Budget
8
+ extend self
9
+
8
10
  def check_budget(worker_id:, tenant_id: nil, estimated_cost: 0, **)
9
11
  period_key = Time.now.utc.strftime('%Y-%m')
10
12
  results = []
@@ -5,7 +5,9 @@ module Legion
5
5
  module Finops
6
6
  module Runners
7
7
  module CostAttribution
8
- def attribute_cost(worker_id:, provider:, model:, input_tokens:,
8
+ extend self
9
+
10
+ def attribute_cost(worker_id:, provider:, model:, input_tokens:, # rubocop:disable Metrics/ParameterLists
9
11
  output_tokens:, tenant_id: nil, team: nil,
10
12
  task_id: nil, extension: nil, thinking_tokens: 0, **)
11
13
  cost = Helpers::CostCalculator.estimate_cost(
@@ -54,7 +56,7 @@ module Legion
54
56
  def metering_available?
55
57
  defined?(Legion::Data) && Legion::Data.respond_to?(:connection) &&
56
58
  Legion::Data.connection&.table_exists?(:metering_records)
57
- rescue StandardError
59
+ rescue StandardError => _e
58
60
  false
59
61
  end
60
62
 
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Finops
6
- VERSION = '0.1.2'
6
+ VERSION = '0.1.3'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-finops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity