Skip to content

fix(rum): report the running SDK, not a literal, in the config request - #32

Open
Fiona2016 wants to merge 2 commits into
publishfrom
fix/remote-config-sdk-from-source
Open

fix(rum): report the running SDK, not a literal, in the config request#32
Fiona2016 wants to merge 2 commits into
publishfrom
fix/remote-config-sdk-from-source

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

What

The remote sampling configuration request hardcoded sdk=android:

append("&sdk=android")

buildConfigUrl() now takes the source, and the caller passes context.source — which it already had in hand at the call site.

Why

context.source is the field that already answers "which SDK is actually running": a cross-platform wrapper sets it to its own name, and it falls back to "android" for a native app. The native SDK already stamps that value on every RUM event it sends — the configuration request was the one place that disagreed.

Two consequences of the literal:

  1. A configuration rule targeting a wrapper could never match the app running it, because the app always announced itself as android.
  2. The same request already reported the wrapper's SDK version, so one request described itself as two different SDKs — the version of one, the name of another.

Reading source settles both, and a native app is unaffected.

Rollout note

This changes what an app embedding a wrapper reports. A configuration rule written against sdk=android in order to reach such an app stops matching once the app picks up this version and has to be retargeted. Worth checking existing rules before releasing.

Tests

  • Both existing buildConfigUrl() tests now pass source = "android" and still expect sdk=android.
  • New M report the wrapper rather than the native SDK W buildConfigUrl() covers the wrapper case and asserts the name and version agree.

./gradlew :features:dd-sdk-android-rum:testReleaseUnitTest --tests "*RemoteConfigControllerTest*" — 78 tests, 0 skipped, 0 failures, 0 errors.

The remote sampling configuration request hardcoded `sdk=android`. A
cross-platform wrapper sets `context.source` to its own name (`react-native`,
`flutter`, ...) and the native SDK already stamps that value on every event it
sends, so the configuration request was the one place that disagreed: a
configuration rule targeting the wrapper could never match the app running it.

The same request already reported the wrapper's SDK version, which made a single
request describe itself as two different SDKs. `buildConfigUrl()` now takes the
source and the caller passes `context.source`, which it already had in hand. A
native app is unaffected — `source` falls back to "android" when no wrapper sets
it.

Note for rollout: an app embedding a wrapper now sends the wrapper's name, so a
rule written against `sdk=android` to reach such an app stops matching and has to
be retargeted.
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.

1 participant