Skip to content

Commit cfdd71e

Browse files
committed
Merge branch 'support/improve_docs' into 'main'
Improve documentation See merge request app-frameworks/esp-insights!110
2 parents 723f4b9 + b4052eb commit cfdd71e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1029
-355
lines changed

.gitlab-ci.yml

+67-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ variables:
88
MAKEFLAGS: "-j8 --no-keep-going"
99
APP_BUILD: "all"
1010
GIT_SUBMODULE_STRATEGY: recursive
11+
ESP_DOCS_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-idf-doc-env-v5.0:2-2"
12+
ESP_DOCS_PATH: "$CI_PROJECT_DIR"
1113

1214
before_script:
1315
# add gitlab ssh key
@@ -187,7 +189,71 @@ unit_tests:
187189
paths:
188190
- $CI_PROJECT_DIR/components/esp_diag_data_store/test/python_tests/*html
189191

190-
push_master_to_github:
192+
build_docs:
193+
stage: build
194+
image: $ESP_DOCS_ENV_IMAGE
195+
tags:
196+
- build_docs
197+
artifacts:
198+
paths:
199+
- docs/_build/*/*/*.txt
200+
- docs/_build/*/*/html/*
201+
expire_in: 4 days
202+
# No cleaning when the artifacts
203+
after_script: []
204+
script:
205+
- cd docs
206+
- pip install -r requirements.txt
207+
- build-docs -l en -t esp32
208+
209+
.deploy_docs_template:
210+
stage: deploy
211+
image: $ESP_DOCS_ENV_IMAGE
212+
tags:
213+
- deploy_docs
214+
needs:
215+
- build_docs
216+
only:
217+
changes:
218+
- "docs/**/*"
219+
script:
220+
- source ${CI_PROJECT_DIR}/docs/utils.sh
221+
- add_doc_server_ssh_keys $DOCS_DEPLOY_PRIVATEKEY $DOCS_DEPLOY_SERVER $DOCS_DEPLOY_SERVER_USER
222+
- export GIT_VER=$(git describe --always)
223+
- pip install -r ${CI_PROJECT_DIR}/docs/requirements.txt
224+
- deploy-docs
225+
226+
deploy_docs_preview:
227+
extends:
228+
- .deploy_docs_template
229+
except:
230+
refs:
231+
- main
232+
variables:
233+
TYPE: "preview"
234+
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
235+
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PREVIEW_PRIVATEKEY"
236+
DOCS_DEPLOY_SERVER: "$DOCS_PREVIEW_SERVER"
237+
DOCS_DEPLOY_SERVER_USER: "$DOCS_PREVIEW_USER"
238+
DOCS_DEPLOY_PATH: "$DOCS_PREVIEW_PATH"
239+
DOCS_DEPLOY_URL_BASE: "$DOCS_PREVIEW_URL_BASE"
240+
241+
deploy_docs_production:
242+
extends:
243+
- .deploy_docs_template
244+
only:
245+
refs:
246+
- main
247+
variables:
248+
TYPE: "production"
249+
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
250+
DOCS_DEPLOY_PRIVATEKEY: "$DOCS_PROD_PRIVATEKEY"
251+
DOCS_DEPLOY_SERVER: "$DOCS_PROD_SERVER"
252+
DOCS_DEPLOY_SERVER_USER: "$DOCS_PROD_USER"
253+
DOCS_DEPLOY_PATH: "$DOCS_PROD_PATH"
254+
DOCS_DEPLOY_URL_BASE: "$DOCS_PROD_URL_BASE"
255+
256+
push_main_to_github:
191257
stage: deploy
192258
image: espressif/idf:release-v5.0
193259
tags:

README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Having remote diagnostics facility helps in identifying such issues faster. ESP
1414

1515
![Insights Overview](docs/_static/overview.png)
1616

17-
Currently, developers can monitor the following information from the web-based dashboard:
17+
Developers can monitor the following information from the web-based dashboard:
1818

1919
- Error logs: Anything that is logged on console with calls with ESP_LOGE by any component in the firmware
2020
- Warning logs: Anything that is logged on console with calls with ESP_LOGW by any component in the firmware
@@ -34,6 +34,12 @@ You can find more details on [Insights Features](FEATURES.md) page.
3434
## Getting Started
3535
Following code should get you started, and your application can start reporting ESP Insights data to the Insights cloud.
3636

37+
### Enabling ESP-Insights
38+
By default, `ESP-Insights` is disabled. User need to enable it via menuconfig option.
39+
`(Component config → ESP Insights)`
40+
41+
To select transport to be used, please follow next step.
42+
3743
### Enabling Insights with HTTPS
3844
For Insights agent HTTPS is configure as the default transport.
3945

@@ -62,7 +68,7 @@ Here is how you can obtain the ESP Insights Auth Key:
6268

6369
### Enabling Insights with MQTT
6470
Configure the default insights transport to MQTT (Component config → ESP Insights → Insights default transport → MQTT).
65-
Alternately you can add `CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y` to `sdkconfig.defaults`.
71+
Alternatively, you can add `CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y` to `sdkconfig.defaults`.
6672

6773
```c
6874
#include <esp_insights.h>
@@ -80,3 +86,32 @@ Alternately you can add `CONFIG_ESP_INSIGHTS_TRANSPORT_MQTT=y` to `sdkconfig.def
8086
You will require the MQTT certs which you can obtain by performing [Claiming](examples/minimal_diagnostics#esp-insights-over-mqtt).
8187

8288
For more details please head over to [examples](examples).
89+
90+
## Behind the Scenes
91+
92+
- As described in the overview section, ESP-Insights collects data of your choice and stores it in storage, the storage currently used is RTC store.
93+
- The data is split into two sections, and the size is configurable via menuconfig:
94+
- Critical: Errors, Warnings and Events
95+
- Non-Critical: Metrics and Variables
96+
- This data is then periodically encoded in CBOR format and is sent over the transport.
97+
- The data send algorithm is dynamic withing a range. It adapts to the need of the reporting.
98+
99+
### RTC data store
100+
ESP-Insight currently uses RTC memory to store the messages until it is sent to the cloud. Unlike, normal RAM, RTC store makes data available across soft resets. Thus, it brodens the usefulness of the data across reboot.
101+
102+
Messages in Critical data take `121` bytes per message. Hence, one can calculate, say a `2048` bytes of critical section can hold `16` messages before it starts dropping new messages.
103+
Likewise Non-critical messages take `49` bytes per message and hence a `1024` bytes storage can hold `21` messages.
104+
105+
The RTC memory is limited and flooding too many messages, makes RTC storage full. Once full, the framework has to drop the messages.
106+
One solution is to increase the data reporting frequency to cloud, and thereby emptying the RTC store frequently.
107+
> **_Note_**
108+
This however comes with the network cost. It is advisable for a developer to keep Insights logging concise and not overdo it.
109+
110+
## Contributing
111+
112+
If you find an issue with ESP-Insights, or wish to submit an enhancement request, please use the Issues section on Github.
113+
For ESP-IDF related issues please use [esp-idf](https://github.com/espressif/esp-idf) repo.
114+
115+
## License
116+
117+
ESP-Insights code is covered under Apache2 license. Submodules and other third party repos have their own license.

components/esp_diag_data_store/include/esp_diag_data_store.h

+2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
extern "C" {
1313
#endif
1414

15+
/** @cond **/
1516
/**
1617
* @brief Data store event base
1718
*/
1819
ESP_EVENT_DECLARE_BASE(ESP_DIAG_DATA_STORE_EVENT);
20+
/** @endcond **/
1921

2022
/**
2123
* @brief Data store events

components/esp_diag_data_store/src/rtc_store/rtc_store.c

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#include <stdint.h>
168
#include <string.h>

components/esp_diag_data_store/src/rtc_store/rtc_store.h

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#pragma once
8+
169
#include <esp_err.h>
1710
#include <esp_event.h>
1811

components/esp_diag_data_store/test/test_data_store.c

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#include <string.h>
168
#include <esp_err.h>

components/esp_diagnostics/include/esp_diagnostics.h

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#pragma once
168

components/esp_diagnostics/include/esp_diagnostics_metrics.h

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
147
#pragma once
158
#include <stdbool.h>
169
#include <esp_err.h>

components/esp_diagnostics/include/esp_diagnostics_network_variables.h

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
147
#pragma once
158

169
#ifdef __cplusplus

components/esp_diagnostics/include/esp_diagnostics_system_metrics.h

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
147
#pragma once
158

169
#ifdef __cplusplus

components/esp_diagnostics/include/esp_diagnostics_variables.h

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
147
#pragma once
8+
159
#include <stdbool.h>
1610
#include <esp_err.h>
1711
#include <esp_diagnostics.h>

components/esp_diagnostics/src/esp_diagnostics_heap_metrics.c

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
146

157
#include <string.h>
168
#include <esp_heap_caps.h>

components/esp_diagnostics/src/esp_diagnostics_internal.h

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
// Copyright 2022 Espressif Systems (Shanghai) PTE LTD
2-
//
3-
// Licensed under the Apache License, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
5-
// You may obtain a copy of the License at
6-
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
// See the License for the specific language governing permissions and
13-
// limitations under the License.
1+
/*
2+
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
147
#pragma once
158

169
#ifdef __cplusplus

0 commit comments

Comments
 (0)