Skip to content

fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677

Merged
abdulraqeeb33 merged 4 commits into
mainfrom
ar/sdk-4820
Jul 8, 2026
Merged

fix: [SDK-4820] ship consumer dontwarn rule for OpenTelemetry to prevent R8 missing-class build failures#2677
abdulraqeeb33 merged 4 commits into
mainfrom
ar/sdk-4820

Conversation

@abdulraqeeb33

@abdulraqeeb33 abdulraqeeb33 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Root cause: When a third-party SDK in the host app bumps opentelemetry-bom (e.g. Embrace -> 1.62.0), it upgrades OneSignal's transitive OpenTelemetry artifacts to a version where io.opentelemetry.api.internal.ApiUsageLogger has been removed. The transitively-pulled opentelemetry-api-incubator alpha (via ExtendedDefaultTracer) still references that class, so the cross-version skew surfaces as fatal R8 Missing class io.opentelemetry.api.internal.ApiUsageLogger errors in consuming apps even though the code path is never executed.
  • Fix: Ship -dontwarn rules in the otel module's consumer-rules.pro. R8 suppresses a "Missing class" diagnostic when the missing class itself matches a -dontwarn, so we match the internal packages directly with -dontwarn io.opentelemetry.**.internal.** — this is referrer-independent and robustly covers ApiUsageLogger regardless of which artifact references it. We keep -dontwarn io.opentelemetry.api.incubator.** alongside it so R8 still surfaces warnings for OneSignal's own actively-used OTel classes (api.logs, sdk, exporter) if a bump ever breaks them. Because consumer rules ship inside the published AAR, this applies to every consuming app automatically — clients don't have to add their own keep/dontwarn rules to build.
  • Risk: Low. This only suppresses R8 missing-class warnings for internal/incubator classes that aren't on the executed code path; it doesn't change runtime behavior.

The shipped rules are:

-dontwarn io.opentelemetry.api.incubator.**
-dontwarn io.opentelemetry.**.internal.**

This is the low-risk Option A. A longer-term Option B — aligning OneSignal's OpenTelemetry dependency versions (so the incubator alpha and core artifacts can't drift across versions) — is recommended as a follow-up.

Test plan

  • Verify the -dontwarn io.opentelemetry.api.incubator.** and -dontwarn io.opentelemetry.**.internal.** rules ship in the published otel AAR's consumer ProGuard rules.
  • Build a minified / R8-enabled app that also pulls a newer opentelemetry-bom (e.g. via Embrace) and confirm there is no Missing class io.opentelemetry.api.internal.ApiUsageLogger error.

Made with Cursor

…ent R8 missing-class build failures

A third-party SDK in the host app (e.g. Embrace bumping opentelemetry-bom to
1.62.0) upgrades OneSignal's transitive OpenTelemetry artifacts to a version
where io.opentelemetry.api.internal.ApiUsageLogger no longer exists. The
transitively-pulled opentelemetry-api-incubator alpha (via ExtendedDefaultTracer)
still references that class, so the cross-version skew surfaces as fatal R8
"Missing class" errors in consuming apps even though the code path never runs.

Shipping the -dontwarn io.opentelemetry.** rule in the otel module's
consumer-rules.pro bundles it into the published AAR, so clients don't have to
add their own keep/dontwarn rules to build.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

✓ Coverage check passed (no source files changed)

📥 View workflow run

abdulraqeeb33 and others added 2 commits July 2, 2026 20:06
Scope the consumer -dontwarn from io.opentelemetry.** to io.opentelemetry.api.incubator.**
so R8 still surfaces missing-class warnings for OneSignal's own actively-used OTel
classes (api.logs, sdk, exporter) while still suppressing the dangling ApiUsageLogger
reference from the unused opentelemetry-api-incubator alpha artifact.
…warn so R8 skew errors are suppressed referrer-independently

Co-authored-by: Cursor <cursoragent@cursor.com>
@fadi-george

Copy link
Copy Markdown
Contributor

Could we narrow -dontwarn io.opentelemetry.**.internal.** to io.opentelemetry.api.internal.ApiUsageLogger or io.opentelemetry.api.internal.**?
The wildcard may suppress missing-class errors for the OTel SDK/exporter internals.

@abdulraqeeb33 abdulraqeeb33 requested a review from a team July 6, 2026 18:04
Address review feedback: the io.opentelemetry.**.internal.** wildcard would also
suppress genuine missing-class errors in the OTel sdk/exporter internals that
OneSignal actively uses. Narrow to io.opentelemetry.api.internal.** so it still
covers the dangling ApiUsageLogger reference (referrer-independent) without
masking real breakage elsewhere.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abdulraqeeb33

Copy link
Copy Markdown
Contributor Author

Good call @fadi-george — narrowed in 94d100b. Scoped the rule from io.opentelemetry.**.internal.** down to io.opentelemetry.api.internal.**, which still covers the dangling ApiUsageLogger reference (referrer-independent) but no longer suppresses missing-class errors in the OTel sdk/exporter internals we actually use. Went with the package wildcard rather than the exact ApiUsageLogger class so sibling api.internal classes that could drift the same way on a future BOM bump are covered too. Updated the explanatory comment in consumer-rules.pro accordingly.

@abdulraqeeb33 abdulraqeeb33 requested a review from fadi-george July 7, 2026 06:19
fadi-george

This comment was marked as duplicate.

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

nit: just update pr description

@abdulraqeeb33 abdulraqeeb33 merged commit 14551dc into main Jul 8, 2026
5 checks passed
@abdulraqeeb33 abdulraqeeb33 deleted the ar/sdk-4820 branch July 8, 2026 17:36
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.

2 participants