Sha256: 20e376908e802eee97bed5a0de096195747376913d04cc811998f746aa5aa17d

Contents?: true

Size: 1.87 KB

Versions: 8

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true

require_relative '../event'

module Datadog
  module Profiling
    module Events
      # Describes a stack profiling event
      class Stack < Event
        attr_reader \
          :hash,
          :frames,
          :total_frame_count,
          :thread_id,
          :root_span_id,
          :span_id,
          :trace_resource

        def initialize(
          timestamp,
          frames,
          total_frame_count,
          thread_id,
          root_span_id,
          span_id,
          trace_resource
        )
          super(timestamp)

          @frames = frames
          @total_frame_count = total_frame_count
          @thread_id = thread_id
          @root_span_id = root_span_id
          @span_id = span_id
          @trace_resource = trace_resource

          @hash = [
            thread_id,
            root_span_id,
            span_id,
            # trace_resource is deliberately not included -- events that share the same (root_span_id, span_id) refer
            # to the same trace
            frames.collect(&:hash),
            total_frame_count
          ].hash
        end
      end

      # Describes a stack sample
      class StackSample < Stack
        attr_reader \
          :cpu_time_interval_ns,
          :wall_time_interval_ns

        def initialize(
          timestamp,
          frames,
          total_frame_count,
          thread_id,
          root_span_id,
          span_id,
          trace_resource,
          cpu_time_interval_ns,
          wall_time_interval_ns
        )
          super(
            timestamp,
            frames,
            total_frame_count,
            thread_id,
            root_span_id,
            span_id,
            trace_resource
          )

          @cpu_time_interval_ns = cpu_time_interval_ns
          @wall_time_interval_ns = wall_time_interval_ns
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ddtrace-1.14.0 lib/datadog/profiling/events/stack.rb
ddtrace-1.13.1 lib/datadog/profiling/events/stack.rb
ddtrace-1.13.0 lib/datadog/profiling/events/stack.rb
ddtrace-1.12.1 lib/datadog/profiling/events/stack.rb
ddtrace-1.12.0 lib/datadog/profiling/events/stack.rb
ddtrace-1.11.1 lib/datadog/profiling/events/stack.rb
ddtrace-1.11.0 lib/datadog/profiling/events/stack.rb
ddtrace-1.11.0.beta1 lib/datadog/profiling/events/stack.rb