|
| 1 | +# Instrumentation |
| 2 | + |
| 3 | +This document explains how to gather instrumentation logs and other diagnostic |
| 4 | +information from a running Dart Analysis Server (DAS) process. |
| 5 | + |
| 6 | +## Collect an instrumentation log |
| 7 | + |
| 8 | +To collect an instrumentation log, DAS needs to be launched with the |
| 9 | +`--instrumentation-log-file` option, specifying a path for the log file. Since |
| 10 | +the IDE launches DAS, the steps are different for each IDE. |
| 11 | + |
| 12 | +### IntelliJ IDEA and Android Studio |
| 13 | + |
| 14 | +1. In IntelliJ IDEA, click **Help** > **Find Action**, type "Registry" and |
| 15 | + open the "Registry..." item. |
| 16 | +2. Scroll down to the `dart.server.additional.arguments` property, and set it's |
| 17 | + value to `--instrumentation-log-file=/some/file.txt`. If there are other |
| 18 | + arguments listed, which you wish to keep, add this new argument to the |
| 19 | + existing value, separated by whitespace. |
| 20 | +3. In the **Dart Analysis** panel, click the  **Restart Dart Analysis Server** |
| 22 | + button. |
| 23 | + |
| 24 | +After doing those steps, DAS will write an instrumentation log to the specified |
| 25 | +file (`/some/file.txt` above). |
| 26 | + |
| 27 | +### VS Code |
| 28 | + |
| 29 | +See the steps outlined at the [Dart Code |
| 30 | +documentation](https://dartcode.org/docs/logging/#analyzer-instrumentation). |
| 31 | + |
| 32 | +## Open the analyzer diagnostics pages |
| 33 | + |
| 34 | +DAS serves a variety of "diagnostics pages" as a website on `localhost`. Since |
| 35 | +the IDE launches DAS, the method of opening this website is different for each |
| 36 | +IDE. |
| 37 | + |
| 38 | +### IntelliJ IDEA and Android Studio |
| 39 | + |
| 40 | +1. In the **Dart Analysis** panel, click the  |
| 41 | + **Analyzer Settings** button on the left with the gear icon. Note, this is |
| 42 | + different from the "Show Options Menu" button at the top, which also has a |
| 43 | + gear icon. |
| 44 | +2. Click the **View analyzer diagnostics** link. The analyzer diagnostics |
| 45 | + website should open in an external browser. |
| 46 | + |
| 47 | +### VS Code |
| 48 | + |
| 49 | +1. Open the command palette (Ctrl+Shift+P) and type "Dart: Open Analyzer |
| 50 | + Diagnostics". The analyzer diagonstics website should open in an external |
| 51 | + browser. |
| 52 | + |
| 53 | +## Using the analyzer diagnostics pages |
| 54 | + |
| 55 | +### Status |
| 56 | + |
| 57 | +The first of the analyzer diagnostics pages is the **Status** page. This page |
| 58 | +shows general information about the DAS process, including version information. |
| 59 | + |
| 60 | +### Code Completion |
| 61 | + |
| 62 | +TODO |
| 63 | + |
| 64 | +### Communications |
| 65 | + |
| 66 | +TODO |
| 67 | + |
| 68 | +### Contexts |
| 69 | + |
| 70 | +TODO |
| 71 | + |
| 72 | +### Environment Variables |
| 73 | + |
| 74 | +This page shows all system environment variables as seen from DAS. |
| 75 | + |
| 76 | +### Exceptions |
| 77 | + |
| 78 | +TODO |
| 79 | + |
| 80 | +### LSP Capabilities |
| 81 | + |
| 82 | +This page is available when DAS is launched as an LSP server, and shows the |
| 83 | +current Client and Server LSP Capabilities. |
| 84 | + |
| 85 | +### Memory and CPU Usage |
| 86 | + |
| 87 | +This page shows current memory and CPU usage of DAS. |
| 88 | + |
| 89 | +### Plugins |
| 90 | + |
| 91 | +TODO |
| 92 | + |
| 93 | +### Subscriptions |
| 94 | + |
| 95 | +TODO |
| 96 | + |
| 97 | +### Timing |
| 98 | + |
| 99 | +TODO |
0 commit comments