Sha256: 52667bf51deec4c1b3bf9e31ee6d395a2bba67a7ac9c1e3f0f8e6b8eaa4c9cbe
Contents?: true
Size: 743 Bytes
Versions: 2
Compression:
Stored size: 743 Bytes
Contents
require 'zlib' class Utility def self.compress_payload(payload, logger) logger.info("Compressing metrics payload") json_payload = payload.to_json # Compress the JSON string using zlib's GzipWriter compressed_payload = StringIO.new Zlib::GzipWriter.wrap(compressed_payload) do |gz| begin gz.write(json_payload) ensure gz.close end end # convert the compressed data to a string compressed_data = compressed_payload.string logger.debug("Original metrics payload size: #{json_payload.bytesize} bytes") logger.debug("Compressed metrics payload size: #{compressed_data.bytesize} bytes") return compressed_data end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-jfrog-send-metrics-0.1.11 | lib/fluent/plugin/utility.rb |
fluent-plugin-jfrog-send-metrics-0.1.10.3 | lib/fluent/plugin/utility.rb |