class ElasticAPM::Transaction

def initialize(

rubocop:disable Metrics/ParameterLists
def initialize(
  name = nil,
  type = nil,
  config:,
  sampled: true,
  sample_rate: 1,
  context: nil,
  trace_context: nil
)
  @name = name
  @type = type || DEFAULT_TYPE
  @config = config
  # Cache these values in case they are changed during the
  # transaction's lifetime via the remote config
  @span_frames_min_duration = config.span_frames_min_duration
  @collect_metrics = config.collect_metrics?
  @breakdown_metrics = config.breakdown_metrics?
  @framework_name = config.framework_name
  @transaction_max_spans = config.transaction_max_spans
  @default_labels = config.default_labels
  @sampled = sampled
  @sample_rate = sample_rate
  @context = context || Context.new # TODO: Lazy generate this?
  if @default_labels
    Util.reverse_merge!(@context.labels, @default_labels)
  end
  unless (@trace_context = trace_context)
    @trace_context = TraceContext.new(
      traceparent: TraceContext::Traceparent.new(recorded: sampled),
      tracestate: TraceContext::Tracestate.new(
        sample_rate: sampled ? sample_rate : 0
      )
    )
  end
  @started_spans = 0
  @dropped_spans = 0
  @notifications = [] # for AS::Notifications
end