Skip to content

RUM-16535: Add APM client side stats models and encoder#3487

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

RUM-16535: Add APM client side stats models and encoder#3487
abrooksv merged 1 commit into
feature/client-side-statsfrom
abrooks/client-side-stats-payloads

Conversation

@abrooksv

@abrooksv abrooksv commented May 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Models the data classes for the APM client side stats payloads: (definition)

Note that while that definition is for a protobuf format, we will be uploading them in their MsgPack format, and the field mappings can be found here

To keep runtime dependency graph small, a minimal encoder is included, but a test dependency on a reference implementation is included in order to validate the implementation

Motivation

This PR models the classes that will eventually be uploaded to the stats intake endpoint.

Additional Notes

The fields we will be sending are based off of the iOS RFC, but which has not yet been put out for code review

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)

@datadog-datadog-prod-us1-2

This comment has been minimized.

@abrooksv abrooksv force-pushed the abrooks/client-side-stats-payloads branch 2 times, most recently from ca58d7e to d85eadc Compare May 29, 2026 22:47
@codecov-commenter

codecov-commenter commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (feature/client-side-stats@59852c8). Learn more about missing BASE report.

Additional details and impacted files
@@                     Coverage Diff                      @@
##             feature/client-side-stats    #3487   +/-   ##
============================================================
  Coverage                             ?   72.44%           
============================================================
  Files                                ?      967           
  Lines                                ?    35834           
  Branches                             ?     5951           
============================================================
  Hits                                 ?    25958           
  Misses                               ?     8269           
  Partials                             ?     1607           
Files with missing lines Coverage Δ
...race/internal/domain/metrics/ClientStatsPayload.kt 100.00% <100.00%> (ø)
...id/trace/internal/domain/metrics/MsgPackEncoder.kt 100.00% <100.00%> (ø)
...roid/trace/internal/domain/metrics/StatsPayload.kt 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

Pull request overview

This PR introduces the client-side APM stats payload model types for the trace feature and a minimal MsgPack encoder to serialize them (with tests validating the produced payload structure against a reference MsgPack unpacker).

Changes:

  • Added stats payload models (StatsPayload, ClientStatsPayload, buckets, grouped stats, and Trilean) with toMsgPackPayload() serialization.
  • Implemented a minimal MsgPackEncoder and accompanying tests to validate encoding of core MsgPack primitives and headers.
  • Updated build/test configuration to include msgpack-core, and updated 3rd-party licensing + detekt safe-call allowlist.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
LICENSE-3rdparty.csv Adds 3rd-party license entry for org.msgpack:msgpack-core (test dependency).
gradle/libs.versions.toml Adds version catalog entry for msgPackCore.
features/dd-sdk-android-trace/build.gradle.kts Adds msgpack-core as a test dependency for the trace feature.
detekt_custom_safe_calls.yml Allows additional safe calls used by the new encoder implementation.
features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/domain/metrics/StatsPayload.kt Adds outer envelope model and MsgPack encoding for the stats intake payload.
features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/domain/metrics/MsgPackEncoder.kt Adds the minimal MsgPack encoder used to build payload bytes.
features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/domain/metrics/ClientStatsPayload.kt Adds client stats payload/bucket/grouped stats models and encoding.
features/dd-sdk-android-trace/src/test/kotlin/com/datadog/android/trace/internal/domain/metrics/StatsPayloadTest.kt Validates the outer payload fields and embedding of pre-encoded client stats.
features/dd-sdk-android-trace/src/test/kotlin/com/datadog/android/trace/internal/domain/metrics/MsgPackEncoderTest.kt Validates encoding of MsgPack primitives/headers via msgpack-core unpacking.
features/dd-sdk-android-trace/src/test/kotlin/com/datadog/android/trace/internal/domain/metrics/ClientStatsPayloadTest.kt Validates the client stats payload field mapping and nested objects.
features/dd-sdk-android-trace/src/test/kotlin/com/datadog/android/trace/assertj/MsgPackAssert.kt Adds a MsgPack-to-JSON assert helper for payload structure assertions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI 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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

@abrooksv abrooksv marked this pull request as ready for review June 1, 2026 16:35
@abrooksv abrooksv requested review from a team as code owners June 1, 2026 16:35
@abrooksv abrooksv force-pushed the abrooks/client-side-stats-payloads branch from 5122318 to 593f193 Compare June 1, 2026 16:45
Adds the intake models for the APM client side stats
Add a minimal MsgPack encoder to serialize the models
@abrooksv abrooksv force-pushed the abrooks/client-side-stats-payloads branch from 62990a1 to 88ca466 Compare June 1, 2026 19:04
@abrooksv abrooksv merged commit 4aad42e into feature/client-side-stats Jun 3, 2026
27 checks passed
@abrooksv abrooksv deleted the abrooks/client-side-stats-payloads branch June 3, 2026 18:19
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