Sha256: ecf1ec756a8dd484e10057147e2f90527af67d27c013663f97ad186114a4aaed

Contents?: true

Size: 1.31 KB

Versions: 29

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require_relative './base'
require_relative '../ext'

module Datadog
  module Tracing
    module Contrib
      module Aws
        module Service
          # States tag handlers.
          class States < Base
            def add_tags(span, params)
              state_machine_name = params[:name]
              state_machine_arn = params[:state_machine_arn]
              execution_arn = params[:execution_arn]
              state_machine_account_id = ''

              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]
                state_machine_account_id = 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]
                state_machine_account_id = parts[-3]
              end
              span.set_tag(Aws::Ext::TAG_AWS_ACCOUNT, state_machine_account_id)
              span.set_tag(Aws::Ext::TAG_STATE_MACHINE_NAME, state_machine_name)
            end
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
ddtrace-1.17.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.16.2 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.16.1 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.16.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.15.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.14.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.13.1 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.13.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.12.1 lib/datadog/tracing/contrib/aws/service/states.rb