-
Couldn't load subscription status.
- Fork 2
feat(android): Add conditional exporters for logs and traces #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`).
tanderson-ld
requested changes
Oct 3, 2025
There was a problem hiding this 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.
- 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.
e2e/android/app/src/test/java/com/example/androidobservability/DisablingConfigOptionsE2ETest.kt
Show resolved
Hide resolved
tanderson-ld
approved these changes
Oct 7, 2025
Merged
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This change introduces conditional exporters for both logs and spans on the Android SDK. These new exporters,
ConditionalLogRecordExporterandConditionalSpanExporter, allow for separate filtering of normal application telemetry versus error and crash reports.Key changes:
ConditionalLogRecordExporter.ktto filter logs, distinguishing between normal logs and crash reports from OpenTelemetry's CrashReporter.ConditionalSpanExporter.ktto filter spans, distinguishing between normal traces and error spans created byrecordError.InstrumentationManager.ktto use these conditional exporters, enabling independent control over sending normal logs/traces and error/crash data based on the configuration options (disableLogs,disableTraces,disableErrorTracking).CompositeLogExporterandCompositeSpanExporterclasses were replaced by using the built-inLogRecordExporter.composite()andSpanExporter.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.
ConditionalLogRecordExporterandConditionalSpanExporterto filter normal telemetry vs crash/error (highlight.error) data.LogRecordExporter.composite/SpanExporter.compositein debug; removeCompositeLogExporter/CompositeSpanExporterusage.disableErrorTrackingis false, regardless ofdisableLogs/disableTraces.ERROR_SPAN_NAMEconstant.ConditionalLogRecordExporterTest,ConditionalSpanExporterTest.DisablingConfigOptionsE2ETestto validate filtered exports, error-as-span when traces disabled, crash-as-log when logs disabled; addgetOptionsAllEnabled()helper.CompositeLogExporter/CompositeSpanExporterand their tests; switch to built-in composites.Written by Cursor Bugbot for commit 137ae73. This will update automatically on new commits. Configure here.