diff --git a/lib/elastic_apm/transport/connection.rb b/lib/elastic_apm/transport/connection.rb index b56fa6d79..a3cd1759a 100644 --- a/lib/elastic_apm/transport/connection.rb +++ b/lib/elastic_apm/transport/connection.rb @@ -37,7 +37,7 @@ class Connection def initialize(config) @config = config - @metadata = JSON.fast_generate( + @metadata = JSON.generate( Serializers::MetadataSerializer.new(config).build( Metadata.new(config) ) diff --git a/lib/elastic_apm/transport/worker.rb b/lib/elastic_apm/transport/worker.rb index 34befc5dc..2b4d0b8a1 100644 --- a/lib/elastic_apm/transport/worker.rb +++ b/lib/elastic_apm/transport/worker.rb @@ -87,7 +87,7 @@ def serialize_and_filter(resource) # if a filter returns nil, it means skip the event return nil if @filters.apply!(serialized) == Filters::SKIP - JSON.fast_generate(serialized) + JSON.generate(serialized) rescue Exception error format('Failed converting event to JSON: %s', resource.inspect) error serialized.inspect diff --git a/spec/elastic_apm/transport/connection/http_spec.rb b/spec/elastic_apm/transport/connection/http_spec.rb index d4e973457..7e791bad5 100644 --- a/spec/elastic_apm/transport/connection/http_spec.rb +++ b/spec/elastic_apm/transport/connection/http_spec.rb @@ -27,7 +27,7 @@ module Transport let(:config) { Config.new(http_compression: false) } let(:metadata) do - JSON.fast_generate(metadata: { service_name: 'Test' }) + JSON.generate(metadata: { service_name: 'Test' }) end let(:url) { 'http://localhost:8200/intake/v2/events' } diff --git a/spec/elastic_apm/transport/connection_spec.rb b/spec/elastic_apm/transport/connection_spec.rb index be99951a8..552798aa6 100644 --- a/spec/elastic_apm/transport/connection_spec.rb +++ b/spec/elastic_apm/transport/connection_spec.rb @@ -189,7 +189,7 @@ module Transport before do config.api_request_size = - "#{JSON.fast_generate(metadata).bytesize - 1}b" + "#{JSON.generate(metadata).bytesize - 1}b" end it 'closes requests when reached' do