# encoding: utf-8 require 'base64' require 'zlib' module OneApm module Support module Encoders module Identity def self.encode(data, opts=nil) data end end module Compressed def self.encode(data, opts=nil) Zlib::Deflate.deflate(data, Zlib::DEFAULT_COMPRESSION) end end module Base64CompressedJSON def self.encode(data, opts={}) normalize_encodings = if opts[:skip_normalization] false else Agent.config[:normalize_json_string_encodings] end json = ::OneApm::JSONWrapper.dump(data, :normalize => normalize_encodings) Base64.encode64(Compressed.encode(json)) end end end end end