-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2730 from DataDog/ar/ConsistentApmSpanTagsForAwsR…
…equests
- Loading branch information
Showing
22 changed files
with
1,440 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# Base class for all AWS service-specific tag handlers. | ||
class Base | ||
def add_tags(span, params); end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# DynamoDB tag handlers. | ||
class DynamoDB < Base | ||
def add_tags(span, params) | ||
table_name = params[:table_name] | ||
span.set_tag(Aws::Ext::TAG_TABLE_NAME, table_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# EventBridge tag handlers. | ||
class EventBridge < Base | ||
def add_tags(span, params) | ||
rule_name = params[:name] || params[:rule] | ||
span.set_tag(Aws::Ext::TAG_RULE_NAME, rule_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# Kinesis tag handlers. | ||
class Kinesis < Base | ||
def add_tags(span, params) | ||
stream_arn = params[:stream_arn] | ||
stream_name = params[:stream_name] | ||
|
||
if stream_arn | ||
# example stream_arn: arn:aws:kinesis:us-east-1:123456789012:stream/my-stream | ||
parts = stream_arn.split(':') | ||
stream_name = parts[-1].split('/')[-1] | ||
aws_account = parts[-2] | ||
span.set_tag(Aws::Ext::TAG_AWS_ACCOUNT, aws_account) | ||
end | ||
|
||
span.set_tag(Aws::Ext::TAG_STREAM_NAME, stream_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# S3 tag handlers. | ||
class S3 < Base | ||
def add_tags(span, params) | ||
bucket_name = params[:bucket] | ||
span.set_tag(Aws::Ext::TAG_BUCKET_NAME, bucket_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# SNS tag handlers. | ||
class SNS < Base | ||
def add_tags(span, params) | ||
topic_arn = params[:topic_arn] | ||
topic_name = params[:name] | ||
if topic_arn | ||
# example topic_arn: arn:aws:sns:us-west-2:123456789012:my-topic-name | ||
parts = topic_arn.split(':') | ||
topic_name = parts[-1] | ||
aws_account = parts[-2] | ||
span.set_tag(Aws::Ext::TAG_AWS_ACCOUNT, aws_account) | ||
end | ||
span.set_tag(Aws::Ext::TAG_TOPIC_NAME, topic_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
module Datadog | ||
module Tracing | ||
module Contrib | ||
module Aws | ||
module Service | ||
# SQS tag handlers. | ||
class SQS < Base | ||
def add_tags(span, params) | ||
queue_url = params[:queue_url] | ||
queue_name = params[:queue_name] | ||
if queue_url | ||
_, _, _, aws_account, queue_name = queue_url.split('/') | ||
span.set_tag(Aws::Ext::TAG_AWS_ACCOUNT, aws_account) | ||
end | ||
span.set_tag(Aws::Ext::TAG_QUEUE_NAME, queue_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.