Skip to content

RUM-9427: Add telemetry for compose instrumentation functions#2601

Merged
ambushwork merged 1 commit into
feature/actions-trackingfrom
yl/kcp/add-instrumentation-telemetry
Apr 16, 2025
Merged

RUM-9427: Add telemetry for compose instrumentation functions#2601
ambushwork merged 1 commit into
feature/actions-trackingfrom
yl/kcp/add-instrumentation-telemetry

Conversation

@ambushwork

@ambushwork ambushwork commented Apr 15, 2025

Copy link
Copy Markdown
Member

What does this PR do?

Before releasing the compose auto instrumentation, we need to add telemetry about the usage of auto instrumentation.
Since it is almost impossible to add telemetry directly, the idea of this PR is to send telemetry when the instrumented function is call.

Main changes in this PR:

  • Before we have two public APIs datadog and NavigationViewTrackingEffect which can be called by user manually and also instrumented by KCP automatically. Now instrumentedDatadog and instrumentedNavigationViewTrackingEffect internal functions are added, and they are reserved to KCP for auto instrumentation. The public APIs stay the same.
  • The public APIs and internal functions will execute the same core functions under the hood, they only difference is that they will send telemetry with different attributes to indicate the way of instrumentation (manual or auto).
  • Two functions send telemetry will different messages, both of them are sent only once.
image
  • There are two additional attributes:
image

Motivation

RUM-9427

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)

@ambushwork
ambushwork force-pushed the yl/kcp/add-instrumentation-telemetry branch 2 times, most recently from e1cd546 to 1899309 Compare April 15, 2025 09:06
@codecov-commenter

codecov-commenter commented Apr 15, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.07%. Comparing base (0b71747) to head (4940e2c).

Files with missing lines Patch % Lines
...n/kotlin/com/datadog/android/compose/Navigation.kt 0.00% 28 Missing ⚠️
.../com/datadog/android/compose/internal/Telemetry.kt 0.00% 16 Missing ⚠️
...lin/com/datadog/android/compose/DatadogModifier.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                      @@
##           feature/actions-tracking    #2601      +/-   ##
============================================================
- Coverage                     70.11%   70.07%   -0.04%     
============================================================
  Files                           810      811       +1     
  Lines                         30332    30380      +48     
  Branches                       5076     5085       +9     
============================================================
+ Hits                          21266    21287      +21     
- Misses                         7647     7683      +36     
+ Partials                       1419     1410       -9     
Files with missing lines Coverage Δ
...lin/com/datadog/android/compose/DatadogModifier.kt 28.57% <0.00%> (-11.43%) ⬇️
.../com/datadog/android/compose/internal/Telemetry.kt 0.00% <0.00%> (ø)
...n/kotlin/com/datadog/android/compose/Navigation.kt 0.00% <0.00%> (ø)

... and 34 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 marked this pull request as ready for review April 15, 2025 13:30
@ambushwork
ambushwork requested review from a team as code owners April 15, 2025 13:30
@ambushwork
ambushwork force-pushed the yl/kcp/add-instrumentation-telemetry branch 2 times, most recently from 43e176d to d888f0b Compare April 15, 2025 15:48
0xnm
0xnm previously approved these changes Apr 15, 2025
level = InternalLogger.Level.INFO,
target = InternalLogger.Target.TELEMETRY,
messageBuilder = { message },
onlyOnce = true,

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.

should we sample sendTelemetry call? even though we have onlyOnce, it can still give us a lot of traffic.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

you mean give an additional sample rate on top of Rum telemetry sample rate?

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.

yes, since here it will be invoked on every usage of the component, potentially, so it may still have a big volume.

@ambushwork
ambushwork merged commit d42c791 into feature/actions-tracking Apr 16, 2025
@ambushwork
ambushwork deleted the yl/kcp/add-instrumentation-telemetry branch April 16, 2025 11:34
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