Class: Datadog::Tracing::Contrib::Aws::Service::States

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/tracing/contrib/aws/service/states.rb

Overview

States tag handlers.

Instance Method Summary collapse

Instance Method Details

#add_tags(span, params) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/datadog/tracing/contrib/aws/service/states.rb', line 13

def add_tags(span, params)
  state_machine_name = params[:name]
  state_machine_arn = params[:state_machine_arn]
  execution_arn = params[:execution_arn]
   = ''

  if execution_arn
    # 'arn:aws:states:us-east-1:123456789012:execution:example-state-machine:example-execution'
    parts = execution_arn.split(':')
    state_machine_name = parts[-2]
     = parts[4]
  end

  if state_machine_arn
    # example statemachinearn: arn:aws:states:us-east-1:123456789012:stateMachine:MyStateMachine
    parts = state_machine_arn.split(':')
    state_machine_name ||= parts[-1]
     = parts[-3]
  end
  span.set_tag(Aws::Ext::TAG_AWS_ACCOUNT, )
  span.set_tag(Aws::Ext::TAG_STATE_MACHINE_NAME, state_machine_name)
end