Sha256: 4efc70c390803bc316e69faa460a0f75012910be1005a2e4c327cd0951ead9e2

Contents?: true

Size: 1.88 KB

Versions: 1

Compression:

Stored size: 1.88 KB

Contents

# typed: true
require 'ddtrace/profiling/event'

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

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

          @frames = frames
          @total_frame_count = total_frame_count
          @thread_id = thread_id
          @trace_id = trace_id
          @span_id = span_id
          @trace_resource = trace_resource

          @hash = [
            thread_id,
            trace_id,
            span_id,
            # trace_resource is deliberately not included -- events that share the same (trace_id, span_id)
            # trace_resource might not match between pairs, but they 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,
          trace_id,
          span_id,
          trace_resource,
          cpu_time_interval_ns,
          wall_time_interval_ns
        )
          super(
            timestamp,
            frames,
            total_frame_count,
            thread_id,
            trace_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

1 entries across 1 versions & 1 rubygems

Version Path
ddtrace-0.53.0 lib/ddtrace/profiling/events/stack.rb