solid_log-core 0.2.0 → 0.2.2

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: 29584710fa24106c9fd34cf056db068a4cc728790d891b036f58efca98f3f622
4
- data.tar.gz: ef9627f82cf2eda9f91be114bf583440a58b76e3722e4619ac6caff143ca128b
3
+ metadata.gz: a18b9a3fc6d70a9f0d2b214d8f627d674eb0cf3336e0c8eb15a3ce87ab958917
4
+ data.tar.gz: 9e9b3fc9217af124bafddc4c372a01e8a280ae7431aeafa50a757ab39d6186c8
5
5
  SHA512:
6
- metadata.gz: 3078d64ae373365594bffebd66914e29569b76142a0a92dc52ed73592507def8a6abdee08505afc55643cc7c74e9732dc798419f95d89cad2fa2d7f87d36fe1c
7
- data.tar.gz: 2a7e1c672513f17cb133a737624d7b9c48b166aa507d38286b33a5e824a7697ae0d98e4e3d85e296d539986b42fce5bc6c4043b04f1a5d88a3ba90a8501c14a3
6
+ metadata.gz: 3e6d28fb7fea4b17bd84da22c266fd2452de3d569ef9d51a61a103cf01375e255b736b860a49696b4795051f95e3321fdae16762d676ceae7bf1dd501ae5057b
7
+ data.tar.gz: 5d1c3797c72cdfeeb96b8063a828f767a753954b15034a10fbf1d37a4954a720833e9bbef3387648819a87f161fbad143f21ef228249bdf7ca972fadfd8f91ae
@@ -49,11 +49,11 @@ Puma::Plugin.create do
49
49
  # Check if we're not in a Rails console or runner
50
50
  # Console and runner set DISABLE_SPRING or have IRB/Runner in ARGV
51
51
  return false if defined?(Rails::Console)
52
- return false if $PROGRAM_NAME.include?('rake')
53
- return false if $PROGRAM_NAME.include?('runner')
54
- return false if ARGV.include?('console')
55
- return false if ARGV.include?('runner')
56
- return false if ARGV.include?('c')
52
+ return false if $PROGRAM_NAME.include?("rake")
53
+ return false if $PROGRAM_NAME.include?("runner")
54
+ return false if ARGV.include?("console")
55
+ return false if ARGV.include?("runner")
56
+ return false if ARGV.include?("c")
57
57
 
58
58
  # If we made it here, we're likely in server mode
59
59
  true
@@ -89,7 +89,7 @@ Puma::Plugin.create do
89
89
  # Exponential backoff on error (max 60 seconds)
90
90
  # Prevents tight error loops
91
91
  backoff_time = [config.parse_interval * 2, 60].min
92
- $stderr.puts "[SolidLog Puma Plugin] Backing off for #{backoff_time}s" if ENV['SOLIDLOG_DEBUG']
92
+ $stderr.puts "[SolidLog Puma Plugin] Backing off for #{backoff_time}s" if ENV["SOLIDLOG_DEBUG"]
93
93
  sleep backoff_time
94
94
  end
95
95
  end
@@ -137,15 +137,15 @@ Puma::Plugin.create do
137
137
  "solid_log_new_entries",
138
138
  { entry_ids: entry_ids }
139
139
  )
140
- $stderr.puts "[SolidLog Puma Plugin] Broadcasted #{entry_ids.size} entries" if ENV['SOLIDLOG_DEBUG']
140
+ $stderr.puts "[SolidLog Puma Plugin] Broadcasted #{entry_ids.size} entries" if ENV["SOLIDLOG_DEBUG"]
141
141
  end
142
142
  rescue => e
143
143
  # Silent failure - broadcasting is optional
144
- $stderr.puts "[SolidLog Puma Plugin] Broadcast failed: #{e.message}" if ENV['SOLIDLOG_DEBUG']
144
+ $stderr.puts "[SolidLog Puma Plugin] Broadcast failed: #{e.message}" if ENV["SOLIDLOG_DEBUG"]
145
145
  end
146
146
 
147
147
  # Log processing stats (directly to STDERR to avoid recursion)
148
148
  def log_stats(stats)
149
- $stderr.puts "[SolidLog Puma Plugin] Processed #{stats[:processed]}, inserted #{stats[:inserted]}, errors #{stats[:errors]}" if ENV['SOLIDLOG_DEBUG']
149
+ $stderr.puts "[SolidLog Puma Plugin] Processed #{stats[:processed]}, inserted #{stats[:inserted]}, errors #{stats[:errors]}" if ENV["SOLIDLOG_DEBUG"]
150
150
  end
151
151
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidLog
4
+ module Core
5
+ module Jobs
6
+ # Conditionally inherit from ActiveJob if available
7
+ # This allows the same job class to work in Rails apps AND solid_log-service
8
+ if defined?(ActiveJob::Base)
9
+ BaseJob = ActiveJob::Base
10
+ else
11
+ # Plain Ruby class when ActiveJob not available
12
+ BaseJob = Class.new do
13
+ def self.queue_as(*_args)
14
+ # No-op when not using ActiveJob
15
+ end
16
+
17
+ def self.perform_later(*args, **kwargs)
18
+ # Synchronous execution when ActiveJob not available
19
+ new.perform(*args, **kwargs)
20
+ end
21
+
22
+ def self.perform_now(*args, **kwargs)
23
+ new.perform(*args, **kwargs)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -3,22 +3,6 @@
3
3
  module SolidLog
4
4
  module Core
5
5
  module Jobs
6
- # Conditionally inherit from ActiveJob if available
7
- if defined?(ActiveJob::Base)
8
- BaseJob = ActiveJob::Base
9
- else
10
- # Plain Ruby class when ActiveJob not available
11
- BaseJob = Class.new do
12
- def self.queue_as(*); end # No-op when not using ActiveJob
13
- def self.perform_later(*args, **kwargs)
14
- new.perform(*args, **kwargs)
15
- end
16
- def self.perform_now(*args, **kwargs)
17
- new.perform(*args, **kwargs)
18
- end
19
- end
20
- end
21
-
22
6
  class CacheCleanupJob < BaseJob
23
7
  queue_as :default
24
8
 
@@ -3,22 +3,6 @@
3
3
  module SolidLog
4
4
  module Core
5
5
  module Jobs
6
- # Conditionally inherit from ActiveJob if available
7
- if defined?(ActiveJob::Base)
8
- BaseJob = ActiveJob::Base
9
- else
10
- # Plain Ruby class when ActiveJob not available
11
- BaseJob = Class.new do
12
- def self.queue_as(*); end # No-op when not using ActiveJob
13
- def self.perform_later(*args, **kwargs)
14
- new.perform(*args, **kwargs)
15
- end
16
- def self.perform_now(*args, **kwargs)
17
- new.perform(*args, **kwargs)
18
- end
19
- end
20
- end
21
-
22
6
  class FieldAnalysisJob < BaseJob
23
7
  queue_as :default
24
8
 
@@ -3,28 +3,6 @@
3
3
  module SolidLog
4
4
  module Core
5
5
  module Jobs
6
- # Conditionally inherit from ActiveJob if available
7
- # This allows the same job class to work in Rails apps AND solid_log-service
8
- if defined?(ActiveJob::Base)
9
- BaseJob = ActiveJob::Base
10
- else
11
- # Plain Ruby class when ActiveJob not available
12
- BaseJob = Class.new do
13
- def self.queue_as(*_args)
14
- # No-op when not using ActiveJob
15
- end
16
-
17
- def self.perform_later(*args, **kwargs)
18
- # Synchronous execution when ActiveJob not available
19
- new.perform(*args, **kwargs)
20
- end
21
-
22
- def self.perform_now(*args, **kwargs)
23
- new.perform(*args, **kwargs)
24
- end
25
- end
26
- end
27
-
28
6
  # ParseJob processes batches of unparsed raw log entries.
29
7
  #
30
8
  # This job can be used in three contexts:
@@ -3,22 +3,6 @@
3
3
  module SolidLog
4
4
  module Core
5
5
  module Jobs
6
- # Conditionally inherit from ActiveJob if available
7
- if defined?(ActiveJob::Base)
8
- BaseJob = ActiveJob::Base
9
- else
10
- # Plain Ruby class when ActiveJob not available
11
- BaseJob = Class.new do
12
- def self.queue_as(*); end # No-op when not using ActiveJob
13
- def self.perform_later(*args, **kwargs)
14
- new.perform(*args, **kwargs)
15
- end
16
- def self.perform_now(*args, **kwargs)
17
- new.perform(*args, **kwargs)
18
- end
19
- end
20
- end
21
-
22
6
  class RetentionJob < BaseJob
23
7
  queue_as :default
24
8
 
@@ -37,7 +37,7 @@ module SolidLog
37
37
  return stats if raw_entries.empty?
38
38
 
39
39
  # Log to STDERR to avoid recursion (only in debug mode)
40
- $stderr.puts "[SolidLog::BatchParsingService] Processing #{raw_entries.size} raw entries" if ENV['SOLIDLOG_DEBUG']
40
+ $stderr.puts "[SolidLog::BatchParsingService] Processing #{raw_entries.size} raw entries" if ENV["SOLIDLOG_DEBUG"]
41
41
 
42
42
  # Get promoted fields cache (for performance)
43
43
  promoted_fields = get_promoted_fields_cache
@@ -95,7 +95,7 @@ module SolidLog
95
95
  Entry.insert_all(entries_to_insert)
96
96
  stats[:inserted] = entries_to_insert.size
97
97
  # Log to STDERR to avoid recursion (only in debug mode)
98
- $stderr.puts "[SolidLog::BatchParsingService] Inserted #{entries_to_insert.size} entries" if ENV['SOLIDLOG_DEBUG']
98
+ $stderr.puts "[SolidLog::BatchParsingService] Inserted #{entries_to_insert.size} entries" if ENV["SOLIDLOG_DEBUG"]
99
99
 
100
100
  # Broadcast new entry IDs for live tail
101
101
  new_entry_ids = Entry.where(raw_id: raw_ids).pluck(:id)
@@ -240,7 +240,7 @@ module SolidLog
240
240
  end
241
241
  rescue StandardError => e
242
242
  # Silent failure - broadcasting is optional (log to STDERR to avoid recursion)
243
- $stderr.puts "[SolidLog::BatchParsingService] Broadcast failed: #{e.message}" if ENV['SOLIDLOG_DEBUG']
243
+ $stderr.puts "[SolidLog::BatchParsingService] Broadcast failed: #{e.message}" if ENV["SOLIDLOG_DEBUG"]
244
244
  end
245
245
  end
246
246
  end
@@ -155,6 +155,6 @@ module SolidLog
155
155
  end
156
156
  end
157
157
  end
158
- end
158
+ end
159
159
  end
160
160
  end
@@ -142,6 +142,6 @@ module SolidLog
142
142
  SolidLog.logger&.info("Completed migration: #{filename}")
143
143
  end
144
144
  end
145
- end
145
+ end
146
146
  end
147
147
  end
@@ -1,5 +1,5 @@
1
1
  module SolidLog
2
2
  module Core
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -31,6 +31,7 @@ require "solid_log/core/services/migration_runner"
31
31
  require "solid_log/core/services/batch_parsing_service"
32
32
 
33
33
  # Jobs
34
+ require "solid_log/core/jobs/base_job"
34
35
  require "solid_log/core/jobs/parse_job"
35
36
  require "solid_log/core/jobs/retention_job"
36
37
  require "solid_log/core/jobs/cache_cleanup_job"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_log-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Loman
@@ -201,6 +201,7 @@ files:
201
201
  - lib/solid_log/core/client/lograge_formatter.rb
202
202
  - lib/solid_log/core/client/retry_handler.rb
203
203
  - lib/solid_log/core/configuration.rb
204
+ - lib/solid_log/core/jobs/base_job.rb
204
205
  - lib/solid_log/core/jobs/cache_cleanup_job.rb
205
206
  - lib/solid_log/core/jobs/field_analysis_job.rb
206
207
  - lib/solid_log/core/jobs/parse_job.rb