From da2343cc9dec476919dca985851280e3ef7c28d2 Mon Sep 17 00:00:00 2001 From: "Ian Christopher B. de Jesus" <3683356+iandjx@users.noreply.github.com> Date: Fri, 14 Feb 2025 21:11:37 +0800 Subject: [PATCH 1/2] add architecture in readme --- .idea/AndroidProjectSystem.xml | 6 ++ .idea/codeStyles/Project.xml | 123 +++++++++++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++ .idea/gradle.xml | 2 - README.md | 63 ++++++++++++++ 5 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 .idea/AndroidProjectSystem.xml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..7643783 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,123 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 41477b0..8d36417 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -10,12 +10,10 @@ - diff --git a/README.md b/README.md index 5c4e9de..4ff1823 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,66 @@ This project is licensed under the [MIT License](LICENSE). For any issues or support, please reach out to [support@monita.com](mailto:support@monita.com). + +# Architecture + +The Monita monitoring solution is composed of three separate libraries that work in tandem to capture, process, and transmit critical application events. Here's a breakdown of each component: + +## 1. Monita Adapter +- **Role:** + Acts as the integration entry point, bridging your app with the Monita monitoring system. + +- **Responsibilities:** + - **Setup & Initialization:** + Initializes the Monita SDK and configures the necessary runtime environment. + - **Byte Buddy Activation:** + Activates the instrumentation agent (via Byte Buddy) required for intercepting network calls and other events. + - **Integration:** + Provides the necessary hooks for the adapter-library to insert interception logic without modifying your application code directly. + +- **Key Point:** + Without the Monita Adapter (typically by invoking its `install` method), neither logging nor network interception is activated, as the entire monitoring pipeline depends on this initialization process. + +## 2. Monita Adapter Library +- **Role:** + Serves as the dynamic instrumentation module using Byte Buddy to intercept and capture events at runtime. + +- **Responsibilities:** + - **Instrumentation via Byte Buddy:** + Utilizes Byte Buddy plugins (configured via resource files) to target specific methods across various libraries (e.g., `OkHttpClient.newCall`). + - **Advice Injection:** + Contains *advice* classes (such as `OHttpCallAdvice`) that are injected at method entry or exit. These advice methods extract essential data, like URL, method, headers, request/response bodies, and performance metrics. + - **Data Forwarding:** + After capturing the relevant details, the library forwards the data to the Monita SDK through methods like `sendDataToServer()` for further processing. + +- **Key Point:** + The adapter library leverages Byte Buddy's runtime instrumentation mechanism so that no source-code changes are needed in the intercepted libraries. It purely focuses on capturing and passing on vital monitoring data. + +## 3. Monita SDK +- **Role:** + Functions as the core engine that processes, batches, and sends the captured data to the Monita server. + +- **Responsibilities:** + - **Core Initialization & Configuration:** + Sets up monitoring configurations (such as filtering rules, vendor settings, and other metadata) and handles overall initialization through its Builder pattern. + - **Data Processing:** + Applies filtering, transforms the intercepted event data, and formats it into standardized payloads. + - **Batching & Persistence:** + Batches multiple events together and manages local storage (using Room) to ensure reliability in scenarios of network loss. + - **Transmission:** + Schedules and dispatches batched data to the Monita server, ensuring efficient use of network resources. + - **Centralized Logging:** + Provides logging and debugging tools that aid in monitoring the system's performance and troubleshooting issues. + +- **Key Point:** + While the adapter library focuses on event interception, the SDK is responsible for the heavy lifting—data transformation, filtering, batching, and transmission. It's the central engine that ensures your monitored data is processed and delivered effectively. + +--- + +Together, these three components form a modular and robust monitoring framework: +- **Monita Adapter** ties your app into the system by initializing the environment. +- **Monita Adapter Library** dynamically intercepts and captures events using bytecode instrumentation. +- **Monita SDK** processes and manages the captured data, ensuring it reaches the Monita server efficiently. + +This architecture allows for a flexible and unobtrusive integration into your Android application, ensuring comprehensive monitoring without significant changes to your existing codebase. + From ab54dbc13a1e39178ec88b6bb31f4640f9e4a536 Mon Sep 17 00:00:00 2001 From: "Ian Christopher B. de Jesus" <3683356+iandjx@users.noreply.github.com> Date: Fri, 14 Feb 2025 22:09:53 +0800 Subject: [PATCH 2/2] update readme --- README.md | 75 +++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 4ff1823..71a96a5 100644 --- a/README.md +++ b/README.md @@ -105,41 +105,11 @@ This project is licensed under the [MIT License](LICENSE). For any issues or support, please reach out to [support@monita.com](mailto:support@monita.com). -# Architecture +## Architecture The Monita monitoring solution is composed of three separate libraries that work in tandem to capture, process, and transmit critical application events. Here's a breakdown of each component: -## 1. Monita Adapter -- **Role:** - Acts as the integration entry point, bridging your app with the Monita monitoring system. - -- **Responsibilities:** - - **Setup & Initialization:** - Initializes the Monita SDK and configures the necessary runtime environment. - - **Byte Buddy Activation:** - Activates the instrumentation agent (via Byte Buddy) required for intercepting network calls and other events. - - **Integration:** - Provides the necessary hooks for the adapter-library to insert interception logic without modifying your application code directly. - -- **Key Point:** - Without the Monita Adapter (typically by invoking its `install` method), neither logging nor network interception is activated, as the entire monitoring pipeline depends on this initialization process. - -## 2. Monita Adapter Library -- **Role:** - Serves as the dynamic instrumentation module using Byte Buddy to intercept and capture events at runtime. - -- **Responsibilities:** - - **Instrumentation via Byte Buddy:** - Utilizes Byte Buddy plugins (configured via resource files) to target specific methods across various libraries (e.g., `OkHttpClient.newCall`). - - **Advice Injection:** - Contains *advice* classes (such as `OHttpCallAdvice`) that are injected at method entry or exit. These advice methods extract essential data, like URL, method, headers, request/response bodies, and performance metrics. - - **Data Forwarding:** - After capturing the relevant details, the library forwards the data to the Monita SDK through methods like `sendDataToServer()` for further processing. - -- **Key Point:** - The adapter library leverages Byte Buddy's runtime instrumentation mechanism so that no source-code changes are needed in the intercepted libraries. It purely focuses on capturing and passing on vital monitoring data. - -## 3. Monita SDK +### 1. Monita SDK (monita-android-sdk) - **Role:** Functions as the core engine that processes, batches, and sends the captured data to the Monita server. @@ -155,15 +125,44 @@ The Monita monitoring solution is composed of three separate libraries that work - **Centralized Logging:** Provides logging and debugging tools that aid in monitoring the system's performance and troubleshooting issues. +### 2. Monita Adapter (monita-adapter) +- **Role:** + Specifically handles the interception of network calls made using OkHttp. + +- **Responsibilities:** + - **OkHttp Instrumentation:** + Uses Byte Buddy to instrument OkHttp methods like `newCall`, `execute`, and `enqueue`. + - **Network Request Capture:** + Intercepts and processes HTTP requests and responses when using OkHttp. + - **Initialization:** + Provides the necessary setup to activate network call monitoring. + - **Key Point:** - While the adapter library focuses on event interception, the SDK is responsible for the heavy lifting—data transformation, filtering, batching, and transmission. It's the central engine that ensures your monitored data is processed and delivered effectively. + This module is only required if your application uses OkHttp for network requests. ---- +### 3. Monita Adapter Library (monita-adapter-library) +- **Role:** + Serves as the dynamic instrumentation module for vendor SDKs, using Byte Buddy to intercept and capture events at runtime. + +- **Responsibilities:** + - **Vendor SDK Instrumentation:** + Contains dedicated Byte Buddy plugins for intercepting calls from various SDKs: + - Firebase Analytics + - Adobe Analytics + - Facebook Events + - Google Ads + - **Method Interception:** + Uses advice classes to capture specific method calls (e.g., Firebase's `logEvent` or Adobe's `trackAction`). + - **Data Forwarding:** + Forwards captured events to the Monita SDK for processing. + +- **Key Point:** + Works independently of the networking library used—vendor events are captured by instrumenting those SDKs directly. Together, these three components form a modular and robust monitoring framework: -- **Monita Adapter** ties your app into the system by initializing the environment. -- **Monita Adapter Library** dynamically intercepts and captures events using bytecode instrumentation. -- **Monita SDK** processes and manages the captured data, ensuring it reaches the Monita server efficiently. +- **Monita SDK** processes and manages the captured data. +- **Monita Adapter** handles OkHttp network call interception. +- **Monita Adapter Library** captures vendor SDK events. -This architecture allows for a flexible and unobtrusive integration into your Android application, ensuring comprehensive monitoring without significant changes to your existing codebase. +This architecture allows for comprehensive monitoring without requiring changes to your existing codebase, whether you're using OkHttp for networking or integrating with various third-party analytics providers.