Skip to content

RUM-16564: Create and register stub for client stats feature if enabled#3523

Merged
abrooksv merged 1 commit into
feature/client-side-statsfrom
abrooks/client-side-stats-feature-registration
Jun 11, 2026
Merged

RUM-16564: Create and register stub for client stats feature if enabled#3523
abrooksv merged 1 commit into
feature/client-side-statsfrom
abrooks/client-side-stats-feature-registration

Conversation

@abrooksv

@abrooksv abrooksv commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

The client stats feature is wired into the CoreTracer via the MetricsAggregator interface defined in the internal tracer module. This is the same interface that dd-trace-java uses to implement the aggregation of client stats before submitting them to the agent, so it is already wired into the correct spot in CoreTracer (before span sampling occurs).

A new config value was also added so we can override the intake location for the stats intake, since it needs to be different than the /spans endpoint that the TraceConfiguration already configures.

Motivation

Sets up the SDK feature for receiving the spans for client stats aggregation from CoreTracer

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)

@codecov-commenter

codecov-commenter commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.45283% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.51%. Comparing base (c033968) to head (ef42e92).

Files with missing lines Patch % Lines
...c/main/java/com/datadog/trace/core/CoreTracer.java 50.00% 2 Missing ⚠️
...tadog/android/trace/internal/ClientStatsFeature.kt 81.82% 2 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           feature/client-side-stats    #3523      +/-   ##
=============================================================
- Coverage                      72.52%   72.51%   -0.01%     
=============================================================
  Files                            971      973       +2     
  Lines                          36071    36121      +50     
  Branches                        5989     5995       +6     
=============================================================
+ Hits                           26158    26192      +34     
- Misses                          8292     8306      +14     
- Partials                        1621     1623       +2     
Files with missing lines Coverage Δ
.../kotlin/com/datadog/android/api/feature/Feature.kt 100.00% <ø> (ø)
...kotlin/com/datadog/android/trace/DatadogTracing.kt 86.84% <100.00%> (+5.59%) ⬆️
...src/main/kotlin/com/datadog/android/trace/Trace.kt 90.91% <100.00%> (+5.19%) ⬆️
...in/com/datadog/android/trace/TraceConfiguration.kt 100.00% <100.00%> (ø)
...id/trace/internal/net/ClientStatsRequestFactory.kt 100.00% <100.00%> (ø)
...c/main/java/com/datadog/trace/core/CoreTracer.java 72.49% <50.00%> (-0.30%) ⬇️
...tadog/android/trace/internal/ClientStatsFeature.kt 81.82% <81.82%> (ø)

... and 37 files with indirect coverage changes

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

@abrooksv abrooksv force-pushed the abrooks/client-side-stats-feature-registration branch 2 times, most recently from 56753f2 to 85a4301 Compare June 10, 2026 14:37
The client stats feature is wired into the CoreTracer via the MetricsAggregator interface. This is the same interface that dd-trace-java uses to implement the aggregation of client stats before submitting them to the agent, so it is already wired into the correct spot in CoreTracer.
@abrooksv abrooksv force-pushed the abrooks/client-side-stats-feature-registration branch from 85a4301 to ef42e92 Compare June 10, 2026 14:53
@abrooksv abrooksv changed the title RUM-16564: Create stub client stats feature and register setting is enabled RUM-16564: Create and register stub for client stats feature if enabled Jun 10, 2026
@abrooksv abrooksv marked this pull request as ready for review June 10, 2026 16:34
@abrooksv abrooksv requested review from a team as code owners June 10, 2026 16:34

@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.

Reviewed commit: ef42e92da7

ℹ️ 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".

internal val networkInfoEnabled: Boolean,
internal val statsComputationEnabled: Boolean
internal val statsComputationEnabled: Boolean,
internal val customStatsEndpointUrl: String?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve TraceConfiguration copy binary compatibility

Adding customStatsEndpointUrl to the primary constructor of this public data class changes the generated copy(...) and copy$default(...) JVM signatures, as reflected in the API diff. Apps compiled against the previous SDK that call TraceConfiguration.copy(...) can then fail with NoSuchMethodError after upgrading the runtime artifact, even though their source still compiles; keep the generated data-class constructor/copy shape stable and store the new internal value outside the primary constructor or behind an overload.

Useful? React with 👍 / 👎.

): Request {
val requestId = UUID.randomUUID().toString()

val baseUrl = customStatsEndpointUrl ?: (context.site.intakeEndpoint + "/api/v0.2/stats")

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.

is it indeed like that - v0.2 or it should be v2 here?

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.

@abrooksv abrooksv merged commit 83c7fbb into feature/client-side-stats Jun 11, 2026
27 checks passed
@abrooksv abrooksv deleted the abrooks/client-side-stats-feature-registration branch June 11, 2026 15:37
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