Sha256: 8d4846477f30688072c919b4eda2ebce787f198eb9a0540cf3bd53f9e26b5998
Contents?: true
Size: 1.92 KB
Versions: 34
Compression:
Stored size: 1.92 KB
Contents
# encoding: utf-8 require 'one_apm/support/marshaller' module OneApm module Support class JsonMarshaller < Marshaller OK_YAJL_VERSION = OneApm::VersionNumber.new("1.2.1") def initialize OneApm::Manager.logger.info "Using JSON marshaller (#{OneApm::JSONWrapper.backend_name})" warn_for_yajl end def warn_for_yajl if defined?(::Yajl) require 'yajl/version' if OneApm::VersionNumber.new(::Yajl::VERSION) < OK_YAJL_VERSION OneApm::Manager.logger.warn "Detected yajl-ruby version #{::Yajl::VERSION} which can cause segfaults with oneapm_rpm's thread profiling features. We strongly recommend you upgrade to the latest yajl-ruby version available." end end rescue => err OneApm::Manager.logger.warn "Failed trying to watch for problematic yajl-ruby version.", err end def dump(ruby, opts={}) prepared = prepare(ruby, opts) if opts[:skip_normalization] normalize_encodings = false else normalize_encodings = OneApm::Manager.config[:normalize_json_string_encodings] end OneApm::JSONWrapper.dump prepared, :normalize => normalize_encodings end def load(data) if data.nil? || data.empty? OneApm::Manager.logger.error "Empty JSON response from collector: '#{data.inspect}'" return nil end return_value OneApm::JSONWrapper.load(data) rescue => e OneApm::Manager.logger.debug "#{e.class.name} : #{e.message} encountered loading collector response: #{data}" raise end def default_encoder Encoders::Base64CompressedJSON end def self.is_supported? OneApm::JSONWrapper.usable_for_collector_serialization? end def format 'json' end def self.human_readable? true # for some definitions of 'human' end end end end
Version data entries
34 entries across 34 versions & 1 rubygems