Skip to content

Conversation

@agrognetti
Copy link
Contributor

@agrognetti agrognetti commented Oct 2, 2025

Summary

This change introduces conditional exporters for both logs and spans on the Android SDK. These new exporters, ConditionalLogRecordExporter and ConditionalSpanExporter, allow for separate filtering of normal application telemetry versus error and crash reports.

Key changes:

  • Added ConditionalLogRecordExporter.kt to filter logs, distinguishing between normal logs and crash reports from OpenTelemetry's CrashReporter.
  • Added ConditionalSpanExporter.kt to filter spans, distinguishing between normal traces and error spans created by recordError.
  • Updated InstrumentationManager.kt to use these conditional exporters, enabling independent control over sending normal logs/traces and error/crash data based on the configuration options (disableLogs, disableTraces, disableErrorTracking).
  • CompositeLogExporter and CompositeSpanExporter classes were replaced by using the built-in LogRecordExporter.composite() and SpanExporter.composite() static methods from the OpenTelemetry SDK.

How did you test this change?

Are there any deployment considerations?


Note

Introduce conditional exporters to independently control normal logs/traces vs error/crash data; replace custom composites with built-in composites and update tests accordingly.

  • SDK (Android):
    • Conditional Exporters: Add ConditionalLogRecordExporter and ConditionalSpanExporter to filter normal telemetry vs crash/error (highlight.error) data.
    • InstrumentationManager:
      • Use LogRecordExporter.composite/SpanExporter.composite in debug; remove CompositeLogExporter/CompositeSpanExporter usage.
      • Wrap exporters with conditional filters allowing errors/crashes when disableErrorTracking is false, regardless of disableLogs/disableTraces.
      • Adjust provider customizers to disable logs/traces only when both the signal and error tracking are disabled; add ERROR_SPAN_NAME constant.
  • Tests:
    • Add unit tests: ConditionalLogRecordExporterTest, ConditionalSpanExporterTest.
    • Update E2E DisablingConfigOptionsE2ETest to validate filtered exports, error-as-span when traces disabled, crash-as-log when logs disabled; add getOptionsAllEnabled() helper.
  • Cleanup:
    • Remove CompositeLogExporter/CompositeSpanExporter and their tests; switch to built-in composites.

Written by Cursor Bugbot for commit 137ae73. This will update automatically on new commits. Configure here.

This change introduces conditional exporters for both logs and spans on the Android SDK. These new exporters, `ConditionalLogRecordExporter` and `ConditionalSpanExporter`, allow for separate filtering of normal application telemetry versus error and crash reports.

Key changes:
-   Added `ConditionalLogRecordExporter.kt` to filter logs, distinguishing between normal logs and crash reports from OpenTelemetry's CrashReporter.
-   Added `ConditionalSpanExporter.kt` to filter spans, distinguishing between normal traces and error spans created by `recordError`.
-   Updated `InstrumentationManager.kt` to use these conditional exporters, enabling independent control over sending normal logs/traces and error/crash data based on the configuration options (`disableLogs`, `disableTraces`, `disableErrorTracking`).
@agrognetti agrognetti requested a review from a team as a code owner October 2, 2025 15:30
Copy link
Contributor

@tanderson-ld tanderson-ld left a comment

Choose a reason for hiding this comment

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

Add a few unit tests.

cursor[bot]

This comment was marked as outdated.

- This change removes the custom `CompositeLogExporter` and `CompositeSpanExporter` classes and their corresponding tests. It replaces their functionality by using the built-in `LogRecordExporter.composite()` and `SpanExporter.composite()` static methods from the OpenTelemetry SDK.
- The `InstrumentationManager` has been updated to use these standard composite exporters when debug mode is enabled.
- E2E tests for disabling telemetry signals have been updated and improved.
@agrognetti agrognetti merged commit 38f6c45 into main Oct 7, 2025
22 checks passed
@agrognetti agrognetti deleted the agrognetti/O11Y-398 branch October 7, 2025 19:34
Vadman97 pushed a commit that referenced this pull request Oct 15, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-observability-android: 0.11.0</summary>

##
[0.11.0](launchdarkly-observability-android-0.10.0...launchdarkly-observability-android-0.11.0)
(2025-10-10)


### Features

* **android:** Add conditional exporters for logs and traces
([#254](#254))
([38f6c45](38f6c45))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Release observability-android 0.11.0 adding conditional exporters for
logs and traces, with version and manifest updates.
> 
> - **Android SDK (`sdk/@launchdarkly/observability-android`)**:
> - **Feature**: Add conditional exporters for logs and traces
(`CHANGELOG.md`).
>   - Bump version to `0.11.0` in `gradle.properties`.
> - **Release metadata**: Update `.release-please-manifest.json` to
`sdk/@launchdarkly/observability-android: 0.11.0`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
01e709d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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