Skip to content

Commit 5c24b20

Browse files
committed
pprof
1 parent 3433b57 commit 5c24b20

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed

content/docs/how-to/observability/index.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,27 @@ authentication:
323323
}
324324
```
325325

326-
## WAHA Debug Mode
327-
If you enable `WAHA_DEBUG_MODE=True`, WAHA exposes a few additional features for helping with
328-
troubleshooting (usually Memory and CPU-related issues).
326+
## Troubleshooting
327+
There's few internal tools to help us (as developers) understand what it's going on under the hood.
328+
The below section you can use if you have any problem, and we asked to collect additional information.
329329

330-
{{< callout context="caution" icon="outline/info-circle" >}}
331-
`WAHA_DEBUG_MODE=True` is for **troubleshooting** purposes only
330+
### Enable Debug Mode
331+
By default, debug mode is off.
332+
333+
Enable it by adding `WAHA_DEBUG_MODE` environment variable:
334+
```bash
335+
WAHA_DEBUG_MODE=True
336+
```
337+
338+
### ALL - Get Node.js heapsnapshot
339+
{{< callout context="note" icon="outline/info-circle" >}}
340+
Works with all engines: **WEBJS**, **GOWS**, **NOWEB**
332341
{{< /callout >}}
333342

334-
### Get Node.js heapsnapshot
343+
- Add `WAHA_DEBUG_MODE=True` env variable
344+
- Restart container
345+
- Execute request (only when the issue's happening to collect the most recent information)
346+
335347
```http request
336348
GET /api/server/debug/heapsnapshot
337349
```
@@ -344,7 +356,15 @@ then click on **Download File**:
344356

345357
![Swagger - Download File](swagger-download-file.png)
346358

347-
### Get Browser Trace
359+
### WEBJS - Get Browser Trace
360+
{{< callout context="note" icon="outline/info-circle" >}}
361+
Works only with **WEBJS** engine
362+
{{< /callout >}}
363+
364+
- Add `WAHA_DEBUG_MODE=True` env variable
365+
- Restart container
366+
- Execute request (only when the issue's happening to collect the most recent information)
367+
348368
```http request
349369
GET /api/server/debug/browser/trace/{SESSION}?seconds=30&categories=%2A
350370
```
@@ -370,19 +390,33 @@ then click on **Download File**:
370390
![Swagger - Download File](swagger-download-file.png)
371391

372392

373-
### GOWS pprof
393+
### GOWS - pprof
394+
{{< callout context="note" icon="outline/info-circle" >}}
395+
Works only with **GOWS** engine
396+
{{< /callout >}}
374397

375-
You can expose the `6060` port and connect using pprof for the **GOWS** engine:
398+
- Add `WAHA_DEBUG_MODE=True` env variable
399+
- Expose `6060` port from the docker (see yaml below)
376400

377-
```bash
378-
go tool pprof -http=:8081 http://localhost:6060/debug/pprof/heap
379-
```
380-
381-
Make sure to add it to docker-compose:
382-
```yaml
401+
```yaml {title="docker-compose.yaml"}
383402
services:
384403
waha:
385404
image: devlikeapro/waha-plus
386405
ports:
387406
- "127.0.0.1:6060:6060"
388407
```
408+
409+
- Restart container
410+
- Use `curl` to collect heap when issue is happening
411+
412+
```bash {title="Download heap"}
413+
curl -s http://localhost:6060/debug/pprof/heap > heap.pb.gz
414+
```
415+
- Send `heap.pb.gz` to developers
416+
417+
- **OR** you can connect and debug it online using built-in http server:
418+
419+
```bash {title="Connect to pprof"}
420+
go tool pprof -http=:8081 http://localhost:6060/debug/pprof/heap
421+
```
422+

hugo_stats.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@
533533
"add-participants",
534534
"admin",
535535
"advanced-sessions",
536+
"all---get-nodejs-heapsnapshot",
536537
"alternative",
537538
"and-more",
538539
"announcement",
@@ -618,6 +619,7 @@
618619
"duration-explained",
619620
"edit-message",
620621
"enable--store",
622+
"enable-debug-mode",
621623
"engineevent",
622624
"engines",
623625
"entities-schema",
@@ -702,6 +704,7 @@
702704
"global-proxy-configuration",
703705
"global-webhooks",
704706
"gows",
707+
"gows---pprof",
705708
"gows-10",
706709
"gows-engine",
707710
"gows-pprof",
@@ -1460,6 +1463,7 @@
14601463
"webhook-security",
14611464
"webhooks",
14621465
"webjs",
1466+
"webjs---get-browser-trace",
14631467
"websockets",
14641468
"what-is-next",
14651469
"what-is-the-difference-between-core-plus-and-pro-tiers",

0 commit comments

Comments
 (0)