Sha256: a3e42bdb549210ffc758263d41a935667af7bf5b078d8609c892362ded0a8b84

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'set'

require 'ddtrace/profiling/flush'
require 'ddtrace/profiling/pprof/template'

module Datadog
  module Profiling
    module Encoding
      module Profile
        # Encodes gathered data into the pprof format
        module Protobuf
          module_function

          def encode(flush)
            return unless flush

            # Create a pprof template from the list of event types
            event_classes = flush.event_groups.collect(&:event_class).uniq
            template = Pprof::Template.for_event_classes(event_classes)

            # Add all events to the pprof
            flush.event_groups.each { |event_group| template.add_events!(event_group.event_class, event_group.events) }

            # Build the profile and encode it
            template.to_pprof
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddtrace-0.49.0 lib/ddtrace/profiling/encoding/profile.rb
ddtrace-0.48.0 lib/ddtrace/profiling/encoding/profile.rb