Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent APM Span tags for AWS SDK Requests 2 #3159

Closed
wants to merge 16 commits into from

Conversation

zARODz11z
Copy link
Contributor

@zARODz11z zARODz11z commented Sep 26, 2023

What does this PR do?

Adds
TAG_STATE_MACHINE_ARN = 'statemachinearn'
TAG_STATE_EXECUTION_ARN = 'execution_arn'

to respective aws sdk request spans

to be in sync with JS and PY, search for the doc name above in cloud search or request link
Motivation:

SVLS-3508
Google docs Downstream Related Resources
Additional Notes:

How to test the change?

Unit tests
For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@zARODz11z zARODz11z requested a review from a team as a code owner September 26, 2023 20:43
@zARODz11z zARODz11z changed the title add cloudwatchlogs, lambda, redshift, states, and tests Consistent APM Span tags for AWS SDK Requests 2 Sep 26, 2023
@github-actions github-actions bot added integrations Involves tracing integrations tracing labels Sep 26, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3159 (8c63aab) into master (bdb127e) will increase coverage by 0.00%.
Report is 20 commits behind head on master.
The diff coverage is 100.00%.

❗ Current head 8c63aab differs from pull request most recent head eef709f. Consider uploading reports for the commit eef709f to get more accurate results

@@           Coverage Diff           @@
##           master    #3159   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files        1284     1284           
  Lines       73911    73914    +3     
  Branches     3418     3418           
=======================================
+ Hits        72565    72568    +3     
  Misses       1346     1346           
Files Coverage Δ
lib/datadog/tracing/contrib/aws/ext.rb 100.00% <100.00%> (ø)
lib/datadog/tracing/contrib/aws/service/states.rb 100.00% <100.00%> (ø)
...datadog/tracing/contrib/aws/service/states_spec.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

state_machine_name ||= parts[6]
state_machine_account_id = parts[4]
end

if execution_arn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of this seemed to flow better as the state_machine_arn is easier to understand

Comment on lines 38 to 39
state_machine_name = parts[6]
state_machine_account_id = parts[4]
Copy link
Member

@marcotc marcotc Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two fields are being overwritten here. Is it intentional that execution_arn overrides state_machine_arn?

Copy link
Contributor Author

@zARODz11z zARODz11z Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning was in a situation where execution arn and statemachine arn are present on the same request but after looking at https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/States/Client.html it seems that wont happen, its either or. I can replace logic with an if and else if so it wont get replaced

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.
You can leave the code as is.
Can you add a comment explaining what you just mentioned above? ^ So in the future we can be confident when making changes to this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment might be unecessary now as I added .nil? to only set if it is nil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and im not entirely confident with #3159 (comment)

@zARODz11z
Copy link
Contributor Author

closing for now as this is a stretch goal, will revisit if it becomes a priority
(notes for edit:
Make two private helper functions 1 for extracting stuff from state_machine_arn and one for execution_arn, it will return the extracted values and then the caller will add the tags to the span.

helper1: adds state_machine_arn tag and extracts/returns other info for caller to tag
helper2: adds execution_arn tag and extracts/returns other info for caller to tag

@zARODz11z zARODz11z closed this Sep 29, 2023
@GustavoCaso GustavoCaso deleted the ar/ConsistentApmSpanTagsForAwsRequests2 branch October 11, 2023 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrations Involves tracing integrations tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants