lib/prometheus/client/mmaped_value.rb in prometheus-client-mmap-0.7.0.beta14 vs lib/prometheus/client/mmaped_value.rb in prometheus-client-mmap-0.7.0.beta15
- old
+ new
@@ -79,16 +79,15 @@
def initialize_file
@@files_lock.synchronize do
unless @@files.has_key?(@file_prefix)
unless @file.nil?
- puts @file
@file.close
end
+ mmaped_file = Helper::MmapedFile.open_process_exclusive_file(@file_prefix)
- filename = File.join(Prometheus::Client.configuration.multiprocess_files_dir, "#{@file_prefix}_#{@@pid}.db")
- @@files[@file_prefix] = MmapedDict.new(filename)
+ @@files[@file_prefix] = MmapedDict.new(mmaped_file)
end
end
@mutex.synchronize do
@file = @@files[@file_prefix]
@@ -108,15 +107,18 @@
def write_value(key, val)
@file.write_value(key, val)
rescue StandardError => e
Prometheus::Client.logger.warn("writing value to #{@file.path} failed with #{e}")
+ Prometheus::Client.logger.debug(e.backtrace.join("\n"))
end
def read_value(key)
@file.read_value(key)
rescue StandardError => e
Prometheus::Client.logger.warn("reading value from #{@file.path} failed with #{e}")
+ Prometheus::Client.logger.debug(e.backtrace.join("\n"))
+ 0
end
end
end
end