Skip to content

RUM-2778: Print error when no-op core is invoked#3290

Merged
ambushwork merged 1 commit into
developfrom
yi.lu/RUM-2778-noopcore-error-logging
Mar 25, 2026
Merged

RUM-2778: Print error when no-op core is invoked#3290
ambushwork merged 1 commit into
developfrom
yi.lu/RUM-2778-noopcore-error-logging

Conversation

@ambushwork

Copy link
Copy Markdown
Member

What does this PR do?

Print error when no-op core is invoked

Motivation

RUM-2778

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)

@ambushwork
ambushwork force-pushed the yi.lu/RUM-2778-noopcore-error-logging branch from 8037fa8 to a713287 Compare March 25, 2026 10:57
@datadog-prod-us1-4

This comment has been minimized.

@codecov-commenter

codecov-commenter commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.48%. Comparing base (c162b57) to head (aa96409).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3290      +/-   ##
===========================================
+ Coverage    71.45%   71.48%   +0.03%     
===========================================
  Files          943      943              
  Lines        34816    34829      +13     
  Branches      5899     5899              
===========================================
+ Hits         24877    24897      +20     
+ Misses        8276     8268       -8     
- Partials      1663     1664       +1     
Files with missing lines Coverage Δ
...tadog/android/core/internal/NoOpInternalSdkCore.kt 21.93% <100.00%> (+13.02%) ⬆️

... and 42 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 March 25, 2026 12:33
@ambushwork
ambushwork requested review from a team as code owners March 25, 2026 12:33
}

override fun getFeature(featureName: String): FeatureScope? = null
override fun getFeature(featureName: String): FeatureScope? {

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.

This may get very spammy, given the number of calls to this method. Maybe we should print here only once?

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.

I think it depends, it's probably enough to print only once per feature, however if the client enables multiple features with no-op core and we print only the error for the first one, then it will be harder for them to discover the issue.

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.

I mean we can leverage onlyOnce argument of the logger, it will be printed once per each feature.

@ambushwork ambushwork Mar 25, 2026

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.

oh yes, I was thinking the same argument, but I didn't realize that the message is unique per feature, so it will print once per feature indeed.

Note: another change is made for the convenience of test for onlyOnce, and I don't see why we need to get() a new SdkInternalLogger every time.

// before
override val internalLogger: InternalLogger
        get() = SdkInternalLogger(this)

// now
override val internalLogger: InternalLogger = SdkInternalLogger(this)

@ambushwork
ambushwork force-pushed the yi.lu/RUM-2778-noopcore-error-logging branch from a713287 to 5a70499 Compare March 25, 2026 13:45
hamorillo
hamorillo previously approved these changes Mar 25, 2026

@hamorillo hamorillo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! 🚀

0xnm
0xnm previously approved these changes Mar 25, 2026
whenever(mockFeature.name) doReturn fakeFeatureName

// When + Then
Mockito.mockStatic(Log::class.java).use {

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.

Do we need to mock if we don't verify log calls anyway? Normally it should be just no-op without mocking.

Probably it is redundant here and in the 2 tests below.

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.

remove mockStatic since it's not necessary, but keep the tests since they can still protect some corner cases.

@ambushwork
ambushwork dismissed stale reviews from 0xnm and hamorillo via aa96409 March 25, 2026 14:06
@ambushwork
ambushwork force-pushed the yi.lu/RUM-2778-noopcore-error-logging branch from 5a70499 to aa96409 Compare March 25, 2026 14:06
@ambushwork
ambushwork merged commit 2602d1d into develop Mar 25, 2026
26 checks passed
@ambushwork
ambushwork deleted the yi.lu/RUM-2778-noopcore-error-logging branch March 25, 2026 15:26
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