Skip to content

Commit fd86d4e

Browse files
committed
document the EKG metrics (and benchmarks, and tracing)
1 parent 4244cee commit fd86d4e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/contributing/contributing.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,35 @@ If you don't want to use [nix](https://nixos.org/guides/install-nix.html), you c
187187

188188
See the [tutorial](./plugin-tutorial.md) on writing a plugin in HLS.
189189

190+
## Measuring, benchmarking and tracing
191+
192+
### Metrics
193+
194+
HLS opens a metrics server on port 8000 exposing GC and ghcide metrics. The ghcide metrics currently exposed are:
195+
196+
- `ghcide.values_count`- count of build results in the store
197+
- `ghcide.database_count` - count of build keys in the store (these two would be the same in the absence of GC)
198+
- `ghcide.build_count` - build count. A key is GC'ed if it is dirty and older than 100 builds
199+
- `ghcide.dirty_keys_count` - non transitive count of dirty build keys
200+
- `ghcide.indexing_pending_count` - count of items in the indexing queue
201+
- `ghcide.exports_map_count` - count of identifiers in the exports map.
202+
203+
### Benchmarks
204+
205+
If you are touching performance sensitive code, take the time to run a differential
206+
benchmark between HEAD and master using the benchHist script. This assumes that
207+
"master" points to the upstream master.
208+
209+
Run the benchmarks with `cabal bench ghcide`.
210+
211+
It should take around 25 minutes and the results will be stored in the `ghcide/bench-results` folder. To interpret the results, see the comments in the `ghcide/bench/hist/Main.hs` module.
212+
213+
More details in [bench/README](../../ghcide/bench/README.md)
214+
215+
### Tracing
216+
217+
HLS records opentelemetry eventlog traces via [opentelemetry](https://hackage.haskell.org/package/opentelemetry). To generate the traces, build with `-eventlog` and run with `+RTS -l`. To visualize the traces, install [Tracy](https://github.com/wolfpld/tracy) and use [eventlog-to-tracy](https://hackage.haskell.org/package/opentelemetry-extra) to open the generated eventlog.
218+
190219
## Adding support for a new editor
191220

192221
Adding support for new editors is fairly easy if the editor already has good support for generic LSP-based extensions.

0 commit comments

Comments
 (0)