![]() |
Edge AI Add-on API 3.0.0
|
| int nrf_edgeai_obsv_memfault_collect | ( | void | ) |
#include <include/nrf_edgeai_obsv/nrf_edgeai_obsv_memfault.h>
Encodes observability metrics as CBOR and stages them for Memfault.
The CBOR blob is stored internally and handed out by the registered CDR source on the next transport drain cycle. Every registered context is reset in the same critical section as its encode, so each payload covers exactly the interval since the previous successful collect.
A staged payload is never overwritten. While the previous payload has not been drained, the function returns -EBUSY and leaves the contexts untouched, so their data keeps accumulating into the next payload. With CONFIG_NRF_EDGEAI_OBSV_MEMFAULT_AUTO_COLLECT, a refused collect is retried as soon as the payload is drained; otherwise call this function again later.
ctx->lock) of all registered observability contexts while encoding and resetting, thus could lead to stall of inference pipeline when called from low priority threads. NRF_EDGEAI_OBSV_ENCODE_LIST_BUFSZ-byte buffer on the calling thread's stack. When invoked from the system workqueue (e.g. via CONFIG_NRF_EDGEAI_OBSV_MEMFAULT_AUTO_COLLECT), increase CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE accordingly.| 0 | Success; payload staged and ready for the next drain cycle. |
| -EINVAL | Not initialized (no context registered). |
| -EBUSY | The previous payload has not been drained yet, or another collect is in progress. Nothing was encoded or reset. |
| -ENODATA | CBOR encoding failed. Contexts were not reset. |