Skip to content
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

nrfconnect port: allow metrics to be used #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ports/nrf-connect-sdk/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ if(CONFIG_MEMFAULT)
list(APPEND MEMFAULT_COMPONENTS http)
endif()

if (CONFIG_MEMFAULT_METRICS)
list(APPEND MEMFAULT_COMPONENTS metrics)
endif()

include(${MEMFAULT_SDK_ROOT}/cmake/Memfault.cmake)
memfault_library(${MEMFAULT_SDK_ROOT} MEMFAULT_COMPONENTS
MEMFAULT_COMPONENTS_SRCS MEMFAULT_COMPONENTS_INC_FOLDERS)
Expand Down
3 changes: 3 additions & 0 deletions ports/nrf-connect-sdk/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ config MEMFAULT_CLEAR_RESET_REG
help
When disabled, the end user is responsible for clearing the reset register. (Bits are
generally sticky across resets)

config MEMFAULT_METRICS
bool "Enable metrics"
8 changes: 7 additions & 1 deletion ports/nrf-connect-sdk/zephyr/src/memfault_platform_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "memfault/core/reboot_tracking.h"
#include "memfault/core/trace_event.h"
#include "memfault/ports/reboot_reason.h"
#ifdef CONFIG_MEMFAULT_METRICS
#include "memfault/metrics/metrics.h"
#endif

// On boot-up, log out any information collected as to why the
// reset took place
Expand All @@ -33,7 +36,10 @@ static int prv_init_and_log_reboot(const struct device *dev) {
memfault_events_storage_boot(s_event_storage, sizeof(s_event_storage));
memfault_reboot_tracking_collect_reset_info(evt_storage);
memfault_trace_event_boot(evt_storage);

#ifdef CONFIG_MEMFAULT_METRICS
sMemfaultMetricBootInfo boot_info = { .unexpected_reboot_count = 1 };
memfault_metrics_boot(evt_storage, &boot_info);
#endif
memfault_build_info_dump();
return 0;
}
Expand Down