-
Notifications
You must be signed in to change notification settings - Fork 127
Make analytics multi-backend, add native solution #1090
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2c1113e
third_party/memfault/port: add missing include
gmarull d21e858
fw/services/common/analytics: add metrics definition file
gmarull bb2f885
fw/services/common/analytics: convert to multi-backend solution
gmarull 59015f8
fw/services/common/analytics: add native analytics backend
gmarull b8e0e3b
fw/services/common/analytics: nativize battery/connectivity metrics
gmarull ab09370
tools: add analytics heartbeat layout extraction script
gmarull 38666bb
tests/fw/services/bluetooth: remove stale analytics test
gmarull 2f91510
agents: ruff is our Python formatter
gmarull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* SPDX-FileCopyrightText: 2026 Core Devices LLC */ | ||
| /* SPDX-License-Identifier: Apache-2.0 */ | ||
|
|
||
| // OS | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(memory_pct_max) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(stack_free_kernel_main_bytes) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(stack_free_kernel_background_bytes) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(stack_free_newtimers_bytes) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SIGNED(utc_offset_s) | ||
|
|
||
| // Battery & Power | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(battery_soc_pct) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(battery_soc_pct_drop) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_UNSIGNED(battery_voltage, 1000) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_SIGNED(battery_voltage_delta, 1000) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(battery_charge_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(battery_discharge_duration_ms) | ||
|
|
||
| // Hardware I/O | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(backlight_on_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(backlight_avg_intensity_pct) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(vibrator_on_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(vibrator_avg_strength_pct) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(hrm_on_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(button_pressed_count) | ||
|
|
||
| // CPU usage | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_UNSIGNED(cpu_running_pct, 100) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_UNSIGNED(cpu_sleep0_pct, 100) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_UNSIGNED(cpu_sleep1_pct, 100) | ||
| PBL_ANALYTICS_METRIC_DEFINE_SCALED_UNSIGNED(cpu_sleep2_pct, 100) | ||
|
|
||
| // Accelerometer | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(accel_sample_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(accel_shake_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(accel_double_tap_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(accel_peek_count) | ||
|
|
||
| // Notifications, phone calls, etc. | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(notification_received_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(notification_received_dnd_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(phone_call_incoming_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(phone_call_time_ms) | ||
|
|
||
| // Modes | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(low_power_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(stationary_time_ms) | ||
|
|
||
| // Watchface | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(watchface_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_STRING(watchface_name, 32) | ||
| PBL_ANALYTICS_METRIC_DEFINE_STRING(watchface_uuid, 39) | ||
|
|
||
| // File system | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(pfs_space_free_kb) | ||
|
|
||
| // NOR Flash | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(flash_spi_write_bytes) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(flash_spi_erase_bytes) | ||
|
|
||
| // BLE | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(ble_adv_short_intvl_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(ble_adv_long_intvl_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(ble_conn_itvl_min_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(ble_conn_itvl_mid_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(ble_conn_itvl_max_time_ms) | ||
|
|
||
| // Settings | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_tracking_enabled) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_enabled) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_measurement_interval) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(settings_health_hrm_activity_tracking_enabled) | ||
|
|
||
| // Application | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(app_message_sent_count) | ||
| PBL_ANALYTICS_METRIC_DEFINE_UNSIGNED(app_message_received_count) | ||
|
|
||
| // Connectivity | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(connectivity_connected_time_ms) | ||
| PBL_ANALYTICS_METRIC_DEFINE_TIMER(connectivity_expected_time_ms) |
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* SPDX-FileCopyrightText: 2026 Core Devices LLC */ | ||
| /* SPDX-License-Identifier: Apache-2.0 */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "analytics.h" | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| struct pbl_analytics_backend_ops { | ||
| void (*set_signed)(enum pbl_analytics_key key, int32_t signed_value); | ||
| void (*set_unsigned)(enum pbl_analytics_key key, uint32_t unsigned_value); | ||
| void (*set_string)(enum pbl_analytics_key key, const char *value); | ||
| void (*timer_start)(enum pbl_analytics_key key); | ||
| void (*timer_stop)(enum pbl_analytics_key key); | ||
| void (*add)(enum pbl_analytics_key key, int32_t amount); | ||
| }; |
20 changes: 0 additions & 20 deletions
20
include/pbl/services/common/analytics/memfault/analytics_impl.h
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
include/pbl/services/common/analytics/null/analytics_impl.h
This file was deleted.
Oops, something went wrong.
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 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 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 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 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 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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.