Sha256: 96c50730b2892d81daa78f7b0719b16c19c65ae53d8379a93f7f638b318bd2e5
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require 'json' module ElasticAPM module Transport # @api private module Serializers # @api private class UnrecognizedResource < InternalError; end # @api private class Serializer def initialize(config) @config = config end private def ms(micros) micros.to_f / 1_000 end end # @api private class Container def initialize(config) @transaction = Serializers::TransactionSerializer.new(config) @span = Serializers::SpanSerializer.new(config) @error = Serializers::ErrorSerializer.new(config) end attr_reader :transaction, :span, :error def serialize(resource) case resource when Transaction transaction.build(resource) when Span span.build(resource) when Error error.build(resource) else raise UnrecognizedResource, resource.inspect end end end def self.new(config) Container.new(config) end end end end require 'elastic_apm/transport/serializers/transaction_serializer' require 'elastic_apm/transport/serializers/span_serializer' require 'elastic_apm/transport/serializers/error_serializer'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-2.0.1 | lib/elastic_apm/transport/serializers.rb |
elastic-apm-2.0.0 | lib/elastic_apm/transport/serializers.rb |