How signalfx/splunk-otel-android works
Main Components
• Instrumentation Core (“splunk-otel-android”): This module handles most of the core logic, such as crash reporting, ANR detection, Activity/Fragment lifecycle monitoring, as well as telemetry collection and the exporting of data.
• Network Instrumentation for Volley (“splunk-otel-android-volley”): This module integrates with Volley to capture network request details, including headers, response data, and server timing attributes.
• Sample Application (“sample-app”): A demonstrative Android app that shows how the instrumentation libraries are integrated into a live app. This helps in visualizing how developers will incorporate the instrumentation into their apps.
• Build Infrastructure: Although not part of the runtime architecture, note that the buildSrc and Gradle scripts (build.gradle.kts, gradle/wrapper, etc.) manage project configurations and conventions for consistent builds.
• External Dependencies and Libraries: The project leverages OpenTelemetry APIs, Splunk RUM APIs, and Android framework components. Also highlighted are integrations with OkHttp (for HTTP client instrumentation) and various gradle tooling elements.
Relationships and Data Flow
• The Sample Application acts as the client that integrates with the instrumentation libraries.
• When the app runs, the instrumentation core (splunk-otel-android) hooks into the Android lifecycle (activities, fragments, etc.) to monitor events like crashes, ANRs, and UI lifecycle events.
• The Volley instrumentation module intercepts network calls made via the Volley client and wraps them so that telemetry (like HTTP attributes and errors) can be collected.
• Both instrumentation modules then interact with the OpenTelemetry APIs and, through SplunkRum, prepare and possibly export telemetry/spans to the Splunk Observability backend.
• The build infrastructure supports modularity and ensures that coding conventions (e.g., error-prone and spotless rules) are consistently applied across the modules.
Architectural Patterns and Design Principles
• Modular Architecture: Separation into clear modules (core instrumentation, Volley integration, sample app, build configuration).
• Instrumentation Hooks: The libraries employ hooks in the Android lifecycle to capture system events and network data, using interceptor patterns for network calls.
• Extensibility: The library exposes APIs (like SplunkRum and OpenTelemetry hooks) that allow manual instrumentation and customization (e.g., span redaction or modification before export).
Detail and Clarity
• That each major component is clearly labeled.
• Annotations if needed to highlight design principles such as modularity, interceptors for network calls, and lifecycle monitoring hooks.