DEV: freeze strings to reduce allocations

approved

#1

DEV: freeze strings to reduce allocations

This has a very minor impact but its a better pattern to use frozen strings and reduces allocations

diff --git a/lib/mobystash/config.rb b/lib/mobystash/config.rb
index 21c816e..646b13c 100644
--- a/lib/mobystash/config.rb
+++ b/lib/mobystash/config.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'logger'
 require 'logstash_writer'
 require 'prometheus/client'
diff --git a/lib/mobystash/container.rb b/lib/mobystash/container.rb
index a97ea47..426a55f 100644
--- a/lib/mobystash/container.rb
+++ b/lib/mobystash/container.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'deep_merge'
 require 'logstash_writer'
 require 'murmurhash3'
diff --git a/lib/mobystash/log_exception.rb b/lib/mobystash/log_exception.rb
index 880e5eb..89875ce 100644
--- a/lib/mobystash/log_exception.rb
+++ b/lib/mobystash/log_exception.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Mobystash
   # Helper to log exceptions.
   module LogException
diff --git a/lib/mobystash/moby_chunk_parser.rb b/lib/mobystash/moby_chunk_parser.rb
index 0f3aabb..6f8fd2f 100644
--- a/lib/mobystash/moby_chunk_parser.rb
+++ b/lib/mobystash/moby_chunk_parser.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Mobystash
   # Turn the chunks of data that come out of a Docker log stream into useful
   # lines of logs.
diff --git a/lib/mobystash/moby_event_worker.rb b/lib/mobystash/moby_event_worker.rb
index 3faec22..50de86a 100644
--- a/lib/mobystash/moby_event_worker.rb
+++ b/lib/mobystash/moby_event_worker.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'docker-api'
 require 'thread'
 
diff --git a/lib/mobystash/sampler.rb b/lib/mobystash/sampler.rb
index ede419d..a737f1d 100644
--- a/lib/mobystash/sampler.rb
+++ b/lib/mobystash/sampler.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 module Mobystash
   class Sampler
     def initialize(config)
diff --git a/lib/mobystash/system.rb b/lib/mobystash/system.rb
index 043511e..374b9a4 100644
--- a/lib/mobystash/system.rb
+++ b/lib/mobystash/system.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'frankenstein/server'
 require 'frankenstein/process_metrics'
 require 'frankenstein/ruby_gc_metrics'

GitHub sha: a7a8d948


Approved #2