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

[DSMS-19] Fix SNS topic format issue #2725

Merged
merged 5 commits into from
Jun 5, 2024
Merged

Conversation

juliannzhou
Copy link
Contributor

@juliannzhou juliannzhou commented Jun 3, 2024

What does this PR do?

This PR fixes the SNS topic format issue raised in the support ticket where SNS topics aren't detected as data streams. The customer traced the issue to the nodeHash function where it checks for correctly formatted tags and returned them.

However, in the isWellFormedEdgeTag check, it will return false for any cases where the tag is a topic that is a full arn (such as topic:arn:aws:sns:eu-west-1:474060719897:sre-spec-api-ops-dev-slo-consumers in the customer's case) because the condition check (j == i) will return true only if there is one colon in the edge tag.

The fix will check that 1) there is a colon, 2) the tag is a topic, and that 3) the tag string contains "arn", then return true for this case so that full arn topic tags are not excluded as well-formed tags.

Motivation

See support ticket

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@juliannzhou juliannzhou requested a review from a team as a code owner June 3, 2024 17:50
@pr-commenter
Copy link

pr-commenter bot commented Jun 3, 2024

Benchmarks

Benchmark execution time: 2024-06-04 14:37:50

Comparing candidate commit 1a078aa in PR branch juliann.zhou/fix-sns-topic-format with baseline commit eeaff7c in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 43 metrics, 1 unstable metrics.

@@ -24,6 +24,9 @@ func isWellFormedEdgeTag(t string) bool {
return true
}
}
if t[:i] == "topic" && strings.Contains(t, "arn") {
Copy link

Choose a reason for hiding this comment

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

It might be a good idea to check that it is a valid arn (to the extent possible; if there isn't a convenient "is this an arn" function available you could get close by verifying that it matches one of the three general formats):

arn:partition:service:region:account-id:resource-id
arn:partition:service:region:account-id:resource-type/resource-id
arn:partition:service:region:account-id:resource-type:resource-id

All of them begin with "arn:" and contain at least five colons, so checking for those two qualities should avoid most false positives like "carnival" or "arnold".

internal/datastreams/pathway.go Outdated Show resolved Hide resolved
Co-authored-by: Dario Castañé <[email protected]>
@juliannzhou
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jun 4, 2024

❌ MergeQueue

You are not allowed to use the merge queue towards main.

If you need support, contact us on Slack #devflow with those details!

@juliannzhou
Copy link
Contributor Author

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jun 4, 2024

❌ MergeQueue

You are not allowed to use the merge queue towards main.

If you need support, contact us on Slack #devflow with those details!

@juliannzhou juliannzhou requested a review from roisinlh June 4, 2024 14:01
@darccio
Copy link
Member

darccio commented Jun 4, 2024

@juliannzhou I'll take care of this merge.

@darccio
Copy link
Member

darccio commented Jun 4, 2024

@roisinlh Can you review the PR again? Thanks!

@DataDog DataDog deleted a comment from dd-devflow bot Jun 4, 2024
@darccio darccio merged commit 2fb4ed0 into main Jun 5, 2024
158 checks passed
@darccio darccio deleted the juliann.zhou/fix-sns-topic-format branch June 5, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants