Skip to main content

Forwarding Chunks via Golioth

Golioth is an IoT platform that provides cloud services for embedded devices. If your project is using Golioth, you can leverage their CoAP client to forward Memfault chunk data to Memfault.

Step 1: Set up the memfault destination

See https://docs.golioth.io/data-routing/destinations/memfault/ for instructions on setting up Memfault as a destination.

By default, Golioth will attach the Golioth Device ID to Memfault chunk data as the reported Memfault Device Serial. Optionally, an alternate_id can be specified to attach a different identifier.

It is recommended to set the alternate_id to the primary_hardware_id, since this typically maps to the device identifier users want to search by in Memfault. This can be configured in Golioth in the memfault destination config:

destination:
type: memfault
version: v1
parameters:
project_key: $MEMFAULT_PROJECT_KEY
alternate_id: primary_hardware_id
tip

If there are more device identifiers you want to attach to Memfault data beyond a device id, you can set a metric using the metrics API (on-device) or via the REST API /attributes endpoint. Then, configure it as an Attribute in the Memfault platform to be able to filter devices by it.

Step 2: Configure Memfault Data Upload

In a periodic task, drain chunks and upload to Golioth via Streaming mode with a Golioth blockwise stream. See the Memfault + Golioth example app for a sample implementation.

Step 3: Configure Device Info

Golioth will attach the chosen device id to Memfault data when uploading to the Memfault cloud. Therefore, the on-device Memfault serial can be empty, but the remaining device info should be customized.

By default, NCS provides a built-in memfault_platform_get_device_info() function with helpful defaults. See Kconfig options in NCS for configuring these!

Step 4: Remove the Memfault Project Key

If you are not connecting directly with Memfault's servers for data upload or OTA, you can set it to a dummy value:

prj.conf
# Disable the HTTP client (needed only for nRF91 projects)
CONFIG_MEMFAULT_HTTP_ENABLE=n

# Set to a dummy value
CONFIG_MEMFAULT_NCS_PROJECT_KEY="NULL"
info

CONFIG_MEMFAULT_NCS_PROJECT_KEY is optional in nRF Connect SDK >=v3.0.0 for any device that does not use MDS or the Memfault HTTP client to upload chunks, which applies for all NCS-based projects leveraging Golioth for chunks forwarding.