Skip to content

RUM-13514: Put Request tag with UUID in DatadogInterceptor#3086

Merged
aleksandr-gringauz merged 3 commits into
developfrom
aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor
Dec 31, 2025
Merged

RUM-13514: Put Request tag with UUID in DatadogInterceptor#3086
aleksandr-gringauz merged 3 commits into
developfrom
aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor

Conversation

@aleksandr-gringauz

@aleksandr-gringauz aleksandr-gringauz commented Dec 30, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

See description of the bug in the ticket (RUM-13514).

This fix is about putting UUID into the Request tags, so that buildResourceId function can use it when it is called before stopResource.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@aleksandr-gringauz

Copy link
Copy Markdown
Contributor Author

@codex review

@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor branch from 154d21c to 0c8d772 Compare December 30, 2025 12:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aleksandr-gringauz
aleksandr-gringauz marked this pull request as ready for review December 30, 2025 12:44
@aleksandr-gringauz
aleksandr-gringauz requested a review from a team as a code owner December 30, 2025 12:44
@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor branch from 0c8d772 to 37b6802 Compare December 30, 2025 12:49
@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor branch 2 times, most recently from ac84fb0 to cc54e1b Compare December 30, 2025 15:47
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Dec 30, 2025

Copy link
Copy Markdown

🎯 Code Coverage
Patch Coverage: 60.00%
Overall Coverage: 66.43% (+0.01%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3fd3f53 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter

codecov-commenter commented Dec 30, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.40%. Comparing base (bcbe8d3) to head (3fd3f53).

Files with missing lines Patch % Lines
...n/com/datadog/android/okhttp/DatadogInterceptor.kt 72.73% 2 Missing and 1 partial ⚠️
...datadog/android/okhttp/trace/TracingInterceptor.kt 33.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3086   +/-   ##
========================================
  Coverage    71.40%   71.40%           
========================================
  Files          881      881           
  Lines        32397    32405    +8     
  Branches      5462     5463    +1     
========================================
+ Hits         23131    23138    +7     
+ Misses        7722     7716    -6     
- Partials      1544     1551    +7     
Files with missing lines Coverage Δ
...datadog/android/okhttp/trace/TracingInterceptor.kt 82.82% <33.33%> (ø)
...n/com/datadog/android/okhttp/DatadogInterceptor.kt 73.20% <72.73%> (-0.46%) ⬇️

... and 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ambushwork
ambushwork previously approved these changes Dec 31, 2025
}
}

private fun Request.Builder.safeAddUUIDTag(uuid: UUID): Request.Builder {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

s this needed? although it may throw ClassCastException here in theory, but we know that the class will match in our code.

@aleksandr-gringauz aleksandr-gringauz Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this line in detekt_custom_unsafe_calls.yml right after a similar line but for TraceContext.

This is now "know unsafe call" and you need to use try-catch in code if you want lint check to pass.

Should it be "know unsafe call"? I think - yes, it can throw ClassCastException here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in this case we usually do this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually, why not. Done.

0xnm
0xnm previously approved these changes Dec 31, 2025
@aleksandr-gringauz
aleksandr-gringauz dismissed stale reviews from 0xnm and ambushwork via c66dddd December 31, 2025 10:01
@aleksandr-gringauz
aleksandr-gringauz force-pushed the aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor branch from c66dddd to 3fd3f53 Compare December 31, 2025 10:01

@Suppress("DEPRECATION")
val requestId = request.buildResourceId(generateUuid = true)
val requestId = request.buildResourceId(generateUuid = false)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In theory we can still keep it as true, right? Since UUID tag is already attached to the request.

@aleksandr-gringauz aleksandr-gringauz Dec 31, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, we can leave generateUuid as true. I changed to false because it looks a bit clearer. We put UUID into tags a few lines above and it would look weird if we had generateUuid = true here.

@aleksandr-gringauz
aleksandr-gringauz merged commit 24b5d98 into develop Dec 31, 2025
26 checks passed
@aleksandr-gringauz
aleksandr-gringauz deleted the aleksandr-gringauz/RUM-13514/put-uuid-as-tag-in-datadog-interceptor branch December 31, 2025 13:25
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.

4 participants