You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Collect metrics and expose an EKG server
* register gc metrics locally
* getDatabaseKeys
* fixups
* Abstract monitoring and put EKG behind a Cabal flag
* Add CI for the new flag
* fix double ifdef
* link to GHC docs for eventlogs
* log when stopping the EKG server
* Allow CPP in modules
* Add doc comments
* Apply suggestions from code review
Co-authored-by: Michael Peyton Jones <[email protected]>
* Compat. with ghc 9.2
* use an ekg-json snapshot that preserves compat. with ghc 8.x
* confine CPP to the EKG module
Co-authored-by: Michael Peyton Jones <[email protected]>
Copy file name to clipboardExpand all lines: docs/contributing/contributing.md
+29
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,35 @@ If you don't want to use [nix](https://nixos.org/guides/install-nix.html), you c
225
225
226
226
See the [tutorial](./plugin-tutorial.md) on writing a plugin in HLS.
227
227
228
+
## Measuring, benchmarking and tracing
229
+
230
+
### Metrics
231
+
232
+
When ghcide is built with the `ekg` flag, HLS opens a metrics server on port 8999 exposing GC and ghcide metrics. The ghcide metrics currently exposed are:
233
+
234
+
- `ghcide.values_count`- count of build results in the store
235
+
- `ghcide.database_count`- count of build keys in the store (these two would be the same in the absence of GC)
236
+
- `ghcide.build_count`- build count. A key is GC'ed if it is dirty and older than 100 builds
237
+
- `ghcide.dirty_keys_count`- non transitive count of dirty build keys
238
+
- `ghcide.indexing_pending_count`- count of items in the indexing queue
239
+
- `ghcide.exports_map_count`- count of identifiers in the exports map.
240
+
241
+
### Benchmarks
242
+
243
+
If you are touching performance sensitive code, take the time to run a differential
244
+
benchmark between HEAD and master using the benchHist script. This assumes that
245
+
"master"points to the upstream master.
246
+
247
+
Run the benchmarks with `cabal bench ghcide`.
248
+
249
+
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.
250
+
251
+
More details in [bench/README](../../ghcide/bench/README.md)
252
+
253
+
### Tracing
254
+
255
+
HLS records opentelemetry [eventlog traces](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-eventlog) 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.
256
+
228
257
## Adding support for a new editor
229
258
230
259
Adding support for new editors is fairly easy if the editor already has good support for generic LSP-based extensions.
<*> option auto (long "monitoring-port"<> metavar "PORT"<> value 8999<> showDefault <> help "Port to use for EKG monitoring (if the binary is built with EKG)")
43
45
where
44
46
checkCommand =Check<$> many (argument str (metavar "FILES/DIRS..."))
45
47
lspCommand =LSP<$ flag' True (long "lsp"<> help "Start talking to an LSP client")
0 commit comments