Sha256: ecf1ec756a8dd484e10057147e2f90527af67d27c013663f97ad186114a4aaed

Contents?: true

Size: 1.31 KB

Versions: 28

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

28 entries across 28 versions & 2 rubygems

Version Path
datadog-2.7.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.6.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.5.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.4.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.3.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.2.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.23.3 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.23.2 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.1.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.0.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.23.1 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.22.0 lib/datadog/tracing/contrib/aws/service/states.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.21.1 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.21.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.20.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.19.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.18.0 lib/datadog/tracing/contrib/aws/service/states.rb
ddtrace-1.17.0 lib/datadog/tracing/contrib/aws/service/states.rb